Skip to content

Commit c86fff4

Browse files
committed
ci: Update workflows to run in new org
1 parent 204fbd6 commit c86fff4

2 files changed

Lines changed: 45 additions & 11 deletions

File tree

.github/workflows/publish-release.yml

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,33 +17,62 @@ on:
1717
required: true
1818
type: boolean
1919
default: true
20+
maven:
21+
description: 'Maven'
22+
required: true
23+
type: boolean
24+
default: true
25+
modrinth:
26+
description: 'Modrinth'
27+
required: true
28+
type: boolean
29+
default: true
30+
curseforge:
31+
description: 'CurseForge'
32+
required: true
33+
type: boolean
34+
default: true
2035

2136
jobs:
2237
create-release:
2338
runs-on: ubuntu-latest
39+
environment: Releases
2440
outputs:
2541
ref: v${{ steps.bump-version.outputs.version }}
2642
version: ${{ steps.bump-version.outputs.version }}
2743
build-matrix: ${{ steps.set-build-matrix.outputs.result }}
2844
publish-matrix: ${{ steps.set-publish-matrix.outputs.result }}
2945
steps:
46+
- uses: actions/create-github-app-token@v2
47+
id: app-token
48+
with:
49+
app-id: ${{ vars.AUTOMATIONS_APP_ID }}
50+
private-key: ${{ secrets.AUTOMATIONS_PRIVATE_KEY }}
3051
- name: Checkout repository
3152
uses: actions/checkout@v4
53+
with:
54+
token: ${{ steps.app-token.outputs.token }}
55+
- name: Get GitHub App User ID
56+
id: get-user-id
57+
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
58+
env:
59+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
60+
- run: |
61+
git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]'
62+
git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com'
3263
- name: Extracting version from properties
3364
shell: bash
3465
run: echo "version=$(cat gradle.properties | grep -w "\bversion\s*=" | cut -d= -f2)" >> $GITHUB_OUTPUT
3566
id: extract-version
3667
- name: Bumping version
37-
uses: TwelveIterationMods/bump-version@v1
68+
uses: TwelveIterations/bump-version@v1
3869
with:
3970
version: ${{ steps.extract-version.outputs.version }}
4071
bump: patch
4172
id: bump-version
4273
- name: Updating version properties
4374
run: |
4475
sed -i "s/^\s*version\s*=.*/version = ${{ steps.bump-version.outputs.version }}/g" gradle.properties
45-
git config user.name "GitHub Actions"
46-
git config user.email "<>"
4776
git commit -am "Set version to ${{ steps.bump-version.outputs.version }}"
4877
git push origin ${BRANCH_NAME}
4978
git tag -a "v${{ steps.bump-version.outputs.version }}" -m "Release ${{ steps.bump-version.outputs.version }}"
@@ -82,9 +111,12 @@ jobs:
82111
const curseForgeProjectId = gradleProperties.match(/^(?!#)curseforge_project_id\s*=\s*(.+)/m);
83112
const modrinthProjectId = gradleProperties.match(/^(?!#)modrinth_project_id\s*=\s*(.+)/m);
84113
const mavenReleases = gradleProperties.match(/^(?!#)maven_releases\s*=\s*(.+)/m);
114+
const publishCurseForge = curseForgeProjectId && ${{inputs.curseforge}};
115+
const publishModrinth = modrinthProjectId && ${{inputs.modrinth}};
116+
const publishMaven = mavenReleases && ${{inputs.maven}};
85117
return {
86118
loader: ['common', includeFabric ? 'fabric' : false, includeForge ? 'forge' : false, includeNeoForge ? 'neoforge' : false].filter(Boolean),
87-
site: [curseForgeProjectId ? 'curseforge' : '', modrinthProjectId ? 'modrinth' : '', mavenReleases ? 'publish' : ''].filter(Boolean),
119+
site: [publishCurseForge ? 'curseforge' : false, publishModrinth ? 'modrinth' : false, publishMaven ? 'publish' : false].filter(Boolean),
88120
exclude: [
89121
{loader: 'common', site: 'curseforge'},
90122
{loader: 'common', site: 'modrinth'}
@@ -98,7 +130,7 @@ jobs:
98130
with:
99131
ref: ${{ needs.create-release.outputs.ref }}
100132
- name: Validate gradle wrapper
101-
uses: gradle/actions/wrapper-validation@v3
133+
uses: gradle/actions/wrapper-validation@v5
102134
- name: Setup JDK
103135
uses: actions/setup-java@v4
104136
with:
@@ -126,7 +158,7 @@ jobs:
126158
with:
127159
ref: ${{ needs.create-release.outputs.ref }}
128160
- name: Validate gradle wrapper
129-
uses: gradle/actions/wrapper-validation@v3
161+
uses: gradle/actions/wrapper-validation@v5
130162
- name: Setup JDK
131163
uses: actions/setup-java@v4
132164
with:
@@ -152,6 +184,7 @@ jobs:
152184
- build-common
153185
publish-release:
154186
runs-on: ubuntu-latest
187+
environment: Releases
155188
strategy:
156189
matrix: ${{fromJson(needs.create-release.outputs.publish-matrix)}}
157190
fail-fast: false
@@ -166,7 +199,7 @@ jobs:
166199
name: ${{ matrix.loader }}-artifact
167200
path: ${{ matrix.loader }}/build
168201
- name: Validate gradle wrapper
169-
uses: gradle/actions/wrapper-validation@v3
202+
uses: gradle/actions/wrapper-validation@v5
170203
- name: Setup JDK
171204
uses: actions/setup-java@v4
172205
with:

.github/workflows/publish-snapshot.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: publish-snapshot
22
on:
33
push:
44
branches:
5-
- '**'
5+
- '[0-9]+.[0-9]+.[0-9]+'
66

77
jobs:
88
prepare-matrix:
@@ -33,14 +33,15 @@ jobs:
3333
};
3434
publish-snapshot:
3535
runs-on: ubuntu-latest
36+
environment: Snapshots
3637
strategy:
3738
matrix: ${{fromJson(needs.prepare-matrix.outputs.matrix)}}
3839
fail-fast: false
3940
steps:
4041
- name: Checkout repository
4142
uses: actions/checkout@v4
4243
- name: Validate gradle wrapper
43-
uses: gradle/actions/wrapper-validation@v3
44+
uses: gradle/actions/wrapper-validation@v5
4445
- name: Setup JDK
4546
uses: actions/setup-java@v4
4647
with:
@@ -53,11 +54,11 @@ jobs:
5354
run: echo "version=$(cat gradle.properties | grep -w "\bversion\s*=" | cut -d= -f2)" >> $GITHUB_OUTPUT
5455
id: extract-version
5556
- name: Bumping version
56-
uses: TwelveIterationMods/bump-version@v1
57+
uses: TwelveIterations/bump-version@v1
5758
with:
5859
version: ${{ steps.extract-version.outputs.version }}
5960
bump: patch
6061
id: bump-version
6162
- name: Publish
6263
run: ./gradlew :${{ matrix.loader }}:${{ matrix.task }} '-Pversion=${{ steps.bump-version.outputs.version }}-SNAPSHOT' '-PmavenUsername=${{ secrets.MAVEN_USER }}' '-PmavenPassword=${{ secrets.MAVEN_PASSWORD }}'
63-
needs: prepare-matrix
64+
needs: prepare-matrix

0 commit comments

Comments
 (0)