aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/build.yml
diff options
context:
space:
mode:
Diffstat (limited to '.github/workflows/build.yml')
-rw-r--r--.github/workflows/build.yml49
1 files changed, 44 insertions, 5 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index b1daf9d..c40a038 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -15,7 +15,7 @@ jobs:
name: Build
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v4
+ - uses: actions/checkout@v5
name: Checkout repository
with:
fetch-tags: true
@@ -24,16 +24,19 @@ jobs:
- uses: ./.github/composite/gradle
- name: Build with gradle
run: |
- ./gradlew remapJar --scan
+ ./gradlew assemble --scan
- name: Move build artifact around and print check sum
run: |
- rm -f build/libs/*sources*.jar
+ rm -f build/libs/*sources*.jar build/libs/*-api.jar
sha256sum build/libs/*.jar
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: built-mod-jar
path: build/libs/Firmament-*.jar
+ exclude: |
+ build/libs/*-sources.jar
+ build/libs/*-api.jar
test:
name: Test
@@ -55,10 +58,10 @@ jobs:
name: Upload
runs-on: ubuntu-latest
needs: build
- if: ${{ 'push' == github.event_name && 'master' == github.ref_name && '637563904' == github.repository_id }}
+ if: ${{ 'push' == github.event_name && ('master' == github.ref_name || startsWith(github.ref_name, 'mc-')) && '637563904' == github.repository_id }}
steps:
- name: Download generated artifact
- uses: actions/download-artifact@v4
+ uses: actions/download-artifact@v5
with:
name: built-mod-jar
- name: Upload to discord
@@ -67,3 +70,39 @@ jobs:
curl "$WEBHOOK_URL" -X POST -H "Content-type: multipart/form-data" --form "files[0]=@$(echo *.jar)"
env:
WEBHOOK_URL: ${{ secrets.WEBHOOK_URL }}
+
+ prepare-release:
+ name: Prepare a release
+ runs-on: ubuntu-22.04
+ needs: build
+ permissions:
+ contents: write
+ if: ${{ 'push' == github.event_name && startsWith(github.ref, 'refs/tags/') }}
+ steps:
+ - uses: actions/checkout@v5
+ name: Checkout repository
+ with:
+ fetch-tags: true
+ fetch-depth: 0
+ filter: 'tree:0'
+
+ - name: Download generated artifact
+ uses: actions/download-artifact@v5
+ with:
+ name: built-mod-jar
+ - name: Generate changelog
+ run: ./docs/generate-changelog.sh > changelog.md
+
+ - name: Upload release
+ env:
+ GH_TOKEN: ${{ github.token }}
+ run: |
+ gh release create --draft -t "Firmament ${GITHUB_REF#refs/tags/}" "${GITHUB_REF#refs/tags/}" -F "changelog.md" "*.jar"
+
+ - name: Notify discord
+ env:
+ ACTOR: ${{ github.actor }}
+ WEBHOOK: ${{ secrets.CONFIDENTIAL_WEBHOOK }}
+ REPO: ${{ github.repository }}
+ run: |
+ curl -X POST "$WEBHOOK" --data "$(jq -n --arg r "$REPO" --arg v "${GITHUB_REF#refs/tags/}" --arg a "$ACTOR" '{"content": ("Created release preview, ready for publishing." + $v+"\n\nSee the draft at https://github.com/"+$r+"/releases/"), "username": $a, "avatar_url": ("https://github.com/" + $a + ".png")}')" -H 'content-type: application/json'