Skip to content

Commit ed661e3

Browse files
authored
Merge pull request #12 from nike4613/ci-changes
Update CI and release actions to include some fixes from main MonoMod CI
2 parents 801e84c + 848752d commit ed661e3

3 files changed

Lines changed: 33 additions & 13 deletions

File tree

.github/workflows/ci.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ jobs:
2121
name: Setup
2222
runs-on: ubuntu-latest
2323
outputs:
24-
should_skip: ${{ steps.skip_check.outputs.should_skip }}
24+
should_skip: ${{ steps.skip_check.outputs.should_skip == 'true' || steps.msg_check.outputs.skip == 'true' }}
25+
upload_pkgs: ${{ steps.msg_check.outputs.skip != 'true' }}
2526
skipped_by: ${{ steps.skip_check.outputs.skipped_by }}
2627
ver: ${{ steps.computever.outputs.ver }}
2728
checkid: ${{ steps.result_check.outpus.check_id }}
@@ -32,7 +33,11 @@ jobs:
3233
with:
3334
cancel_others: true
3435
concurrent_skipping: same_content_newer
35-
36+
37+
- name: Check if this run is skipped by commit message
38+
id: msg_check
39+
run: echo "skip=${{ github.event_name == 'push' && contains(github.event.head_commit.message, '[skip-ci]') }}" >> $env:GITHUB_OUTPUT
40+
3641
- name: Compute Version
3742
id: computever
3843
run: echo "ver=$(Get-Date -Format y.M.d).${{ github.run_number }}.${{ github.run_attempt }}" >> $env:GITHUB_OUTPUT
@@ -47,8 +52,8 @@ jobs:
4752

4853
upload:
4954
needs: [setup, build]
50-
if: github.ref_name == 'master'
55+
if: ${{ needs.setup.upload_pkgs == 'true' && github.ref_name == 'master' && (success() || needs.setup.result == 'success') }}
5156
name: Upload Packages
5257
uses: ./.github/workflows/upload-packages.yml
5358
with:
54-
workflow-id: ${{ needs.setup.outputs.should_skip == 'true' && fromJSON(needs.setup.outputs.skipped_by).workflowId || github.run_id }}
59+
run-id: ${{ needs.setup.outputs.should_skip == 'true' && fromJSON(needs.setup.outputs.skipped_by).id || github.run_id }}

.github/workflows/release.yml

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,24 +86,37 @@ jobs:
8686

8787
bump-ver:
8888
name: Bump versions
89-
needs: [setup, build]
89+
needs: [setup, upload-github, upload-nuget]
90+
if: ${{ !failure() && !cancelled() }}
9091
runs-on: ubuntu-latest
9192

9293
permissions:
9394
contents: write
9495

9596
steps:
97+
- name: Authenticate as app
98+
uses: actions/create-github-app-token@v2
99+
id: app_tok
100+
with:
101+
app-id: ${{ vars.APP_ID }}
102+
private-key: ${{ secrets.APP_PRIVKEY }}
103+
96104
- name: Checkout
97105
uses: actions/checkout@v4
106+
with:
107+
token: ${{ steps.app_tok.outputs.token }} # checkout using the app token so we can push directly to the repo head
108+
lfs: true
109+
submodules: true
98110

99-
# first, make release/tag
100111
- name: Download compiled packages
101112
uses: actions/download-artifact@v4
102113
with:
103114
name: packages
104115
path: artifacts/package/release/
105116
github-token: ${{ github.token }}
106117
run-id: ${{ github.run_id }}
118+
119+
# first, make release/tag
107120
- name: Create release
108121
uses: softprops/action-gh-release@v2
109122
if: '!inputs.dryrun'
@@ -142,9 +155,11 @@ jobs:
142155
if: '!inputs.prerelease'
143156
uses: EndBug/add-and-commit@v9
144157
with:
145-
add: Version.props
146-
message: "[BOT]: Bump version after ${{ needs.setup.outputs.ver }}"
147-
committer_name: GitHub Actions
148-
committer_email: 41898282+github-actions[bot]@users.noreply.github.com
149-
push: ${{ !inputs.dryrun }}
158+
message: |
159+
[BOT]: Bump version after ${{ needs.setup.outputs.ver }} release
160+
161+
[skip-ci]
162+
default_author: github_actions
163+
push: ${{ !inputs.dryrun && 'origin --force --set-upstream' || 'false' }}
150164
pathspec_error_handling: exitAtEnd
165+

.github/workflows/upload-packages.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Upload Packages
33
on:
44
workflow_call:
55
inputs:
6-
workflow-id:
6+
run-id:
77
type: string
88
default: ${{ github.run_id }}
99
description: The ID of the workflow to upload packages from
@@ -53,7 +53,7 @@ jobs:
5353
name: packages
5454
path: artifacts/package/release/
5555
github-token: ${{ github.token }}
56-
run-id: ${{ inputs.workflow-id }}
56+
run-id: ${{ inputs.run-id }}
5757

5858
- name: Push packages
5959
run: dotnet nuget push -s "${{ inputs.nuget-url }}" -k ${{ secrets.nuget-key || github.token }} (Get-Item artifacts/package/release/*.nupkg)

0 commit comments

Comments
 (0)