diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ec9f8fb..780c845 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,8 @@ jobs: name: Setup runs-on: ubuntu-latest outputs: - should_skip: ${{ steps.skip_check.outputs.should_skip }} + should_skip: ${{ steps.skip_check.outputs.should_skip == 'true' || steps.msg_check.outputs.skip == 'true' }} + upload_pkgs: ${{ steps.msg_check.outputs.skip != 'true' }} skipped_by: ${{ steps.skip_check.outputs.skipped_by }} ver: ${{ steps.computever.outputs.ver }} checkid: ${{ steps.result_check.outpus.check_id }} @@ -32,7 +33,11 @@ jobs: with: cancel_others: true concurrent_skipping: same_content_newer - + + - name: Check if this run is skipped by commit message + id: msg_check + run: echo "skip=${{ github.event_name == 'push' && contains(github.event.head_commit.message, '[skip-ci]') }}" >> $env:GITHUB_OUTPUT + - name: Compute Version id: computever run: echo "ver=$(Get-Date -Format y.M.d).${{ github.run_number }}.${{ github.run_attempt }}" >> $env:GITHUB_OUTPUT @@ -47,8 +52,8 @@ jobs: upload: needs: [setup, build] - if: github.ref_name == 'master' + if: ${{ needs.setup.upload_pkgs == 'true' && github.ref_name == 'master' && (success() || needs.setup.result == 'success') }} name: Upload Packages uses: ./.github/workflows/upload-packages.yml with: - workflow-id: ${{ needs.setup.outputs.should_skip == 'true' && fromJSON(needs.setup.outputs.skipped_by).workflowId || github.run_id }} + run-id: ${{ needs.setup.outputs.should_skip == 'true' && fromJSON(needs.setup.outputs.skipped_by).id || github.run_id }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0403ec2..97c83ca 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -86,17 +86,28 @@ jobs: bump-ver: name: Bump versions - needs: [setup, build] + needs: [setup, upload-github, upload-nuget] + if: ${{ !failure() && !cancelled() }} runs-on: ubuntu-latest permissions: contents: write steps: + - name: Authenticate as app + uses: actions/create-github-app-token@v2 + id: app_tok + with: + app-id: ${{ vars.APP_ID }} + private-key: ${{ secrets.APP_PRIVKEY }} + - name: Checkout uses: actions/checkout@v4 + with: + token: ${{ steps.app_tok.outputs.token }} # checkout using the app token so we can push directly to the repo head + lfs: true + submodules: true - # first, make release/tag - name: Download compiled packages uses: actions/download-artifact@v4 with: @@ -104,6 +115,8 @@ jobs: path: artifacts/package/release/ github-token: ${{ github.token }} run-id: ${{ github.run_id }} + + # first, make release/tag - name: Create release uses: softprops/action-gh-release@v2 if: '!inputs.dryrun' @@ -142,9 +155,11 @@ jobs: if: '!inputs.prerelease' uses: EndBug/add-and-commit@v9 with: - add: Version.props - message: "[BOT]: Bump version after ${{ needs.setup.outputs.ver }}" - committer_name: GitHub Actions - committer_email: 41898282+github-actions[bot]@users.noreply.github.com - push: ${{ !inputs.dryrun }} + message: | + [BOT]: Bump version after ${{ needs.setup.outputs.ver }} release + + [skip-ci] + default_author: github_actions + push: ${{ !inputs.dryrun && 'origin --force --set-upstream' || 'false' }} pathspec_error_handling: exitAtEnd + diff --git a/.github/workflows/upload-packages.yml b/.github/workflows/upload-packages.yml index 21ee2c2..d30f6e2 100644 --- a/.github/workflows/upload-packages.yml +++ b/.github/workflows/upload-packages.yml @@ -3,7 +3,7 @@ name: Upload Packages on: workflow_call: inputs: - workflow-id: + run-id: type: string default: ${{ github.run_id }} description: The ID of the workflow to upload packages from @@ -53,7 +53,7 @@ jobs: name: packages path: artifacts/package/release/ github-token: ${{ github.token }} - run-id: ${{ inputs.workflow-id }} + run-id: ${{ inputs.run-id }} - name: Push packages run: dotnet nuget push -s "${{ inputs.nuget-url }}" -k ${{ secrets.nuget-key || github.token }} (Get-Item artifacts/package/release/*.nupkg)