Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update update-packages.yml #72

Merged
merged 1 commit into from
Nov 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 33 additions & 25 deletions .github/workflows/update-packages.yml
Original file line number Diff line number Diff line change
@@ -1,76 +1,84 @@
name: Update packages

on:
on:
workflow_dispatch:
schedule:
- cron: "0 2 * * 0"

concurrency:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
jobs:

update_packages:
name: Update packages
runs-on: windows-latest

runs-on: self-hosted
outputs:
branchExists: ${{ steps.verify-changed-files.outputs.files_changed }}

steps:
- name: Generate a token
id: generate_token
uses: tibdex/[email protected]
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}

- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ steps.generate_token.outputs.token }}

- name: Set solution name
run: |
echo "solution=$(([io.fileinfo]$(Get-ChildItem -Path .\* -Include *.sln)).name)" | Out-File -FilePath $env:GITHUB_ENV -Append

- name: Add MSBuild to PATH
uses: microsoft/[email protected]
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true

- name: Setup Nuget
uses: nuget/setup-nuget@v1
uses: nuget/setup-nuget@v1
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
- name: Create new branch
ACTIONS_ALLOW_UNSECURE_COMMANDS: true

- name: Create new branch
run: git branch features/update_dependencies_${{ github.run_number }}

- name: Switch branch
run: git checkout features/update_dependencies_${{ github.run_number }}
run: git checkout features/update_dependencies_${{ github.run_number }}

- name: NuGet restore
run: nuget restore

- name: Update NuGet packages
run: nuget update "${{ env.solution }}" -FileConflictAction Ignore

- name: Setup GIT config
run: |
git config user.name "dotNETFrameworkUpdater"
git config user.email "<>"
git config user.name "net-framework-updater[bot]"
git config user.email "136581072+net-framework-updater[bot]@users.noreply.github.com"
git config --global --add --bool push.autoSetupRemote true


- name: Verify Changed files
uses: tj-actions/verify-changed-files@v16
id: verify-changed-files

- name: Commit and Push
if: steps.verify-changed-files.outputs.files_changed == 'true'
run: |
git add .
git commit -a -m "Packages update (CI)"
git push

create_pull_request:
name: Create pull request
runs-on: ubuntu-latest
needs: update_packages
if: needs.update_packages.outputs.branchExists == 'true'

steps:
- name: Generate a token
Expand All @@ -79,23 +87,23 @@ jobs:
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}

- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ steps.generate_token.outputs.token }}
ref: features/update_dependencies_${{ github.run_number }}

- name: Create pull request
uses: devops-infra/[email protected]
with:
github_token: ${{ steps.generate_token.outputs.token }}
source_branch: features/update_dependencies_${{ github.run_number }}
source_branch: feature/update_dependencies_${{ github.run_number }}
target_branch: main
title: Update NuGet packages
assignee: guibranco
reviewer: guibranco
label: dependencies,.NET,infra,NuGet,packages
label: dependencies,.NET,infra,nuget,packages
template: .github/PULL_REQUEST_TEMPLATE/FEATURE.md
get_diff: true
Loading