Skip to content

Commit f78864b

Browse files
committed
update workflow
1 parent ef3492f commit f78864b

3 files changed

Lines changed: 33 additions & 22 deletions

File tree

.github/scripts/meta.sh

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,19 @@
22

33
set -euo pipefail
44

5+
name="$(tomlq -r '.name' < pack.toml)"
6+
slug="$(printf '%s' "$name" | tr '[:upper:]' '[:lower:]' | sed -E 's/[^a-z0-9]+/-/g; s/^-+|-+$//g')"
57
version="$(tomlq -r '.version' < pack.toml)"
6-
slug="$(tomlq -r '.name' < pack.toml | tr '[:upper:]' '[:lower:]' | sed -E 's/[^a-z0-9]+/-/g; s/^-+|-+$//g')"
78
minecraft_version="$(tomlq -r '.versions.minecraft' < pack.toml)"
89
forge_version="$(tomlq -r '.versions.forge' < pack.toml)"
10+
short_sha="${GITHUB_SHA::7}"
11+
12+
{
13+
echo "NAME=$name"
14+
echo "SLUG=$slug"
15+
echo "VERSION=$version"
16+
echo "MINECRAFT_VERSION=$minecraft_version"
17+
echo "FORGE_VERSION=$forge_version"
18+
echo "SHORT_SHA"="$short_sha"
19+
} >> "$GITHUB_ENV"
920

10-
echo "VERSION=$version" >> "$GITHUB_ENV"
11-
echo "SLUG=$slug" >> "$GITHUB_ENV"
12-
echo "MINECRAFT_VERSION=$minecraft_version" >> "$GITHUB_ENV"
13-
echo "FORGE_VERSION=$forge_version" >> "$GITHUB_ENV"

.github/workflows/nightly.yml

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ name: Nightly Modpack Build
22

33
on:
44
push:
5+
branches:
6+
- 'main'
7+
- 'workflow'
58

69
env:
710
MANIFEST_REPO: GregTechLite/gregtechlite.github.io
@@ -48,13 +51,6 @@ jobs:
4851
id: package_server
4952
run: bash .github/scripts/server.sh "${SLUG}-nightly" "${MANIFEST_BASE_URL}/nightly/pack.toml"
5053

51-
- name: Prepare nightly metadata
52-
id: nightly_meta
53-
run: |
54-
short_sha="${GITHUB_SHA::7}"
55-
echo "label=Nightly ${short_sha}" >> "$GITHUB_OUTPUT"
56-
echo "artifact_name=${SLUG}-nightly-${short_sha}" >> "$GITHUB_OUTPUT"
57-
5854
- name: Deploy nightly manifest
5955
uses: peaceiris/actions-gh-pages@v4
6056
with:
@@ -65,31 +61,31 @@ jobs:
6561
destination_dir: nightly
6662
user_name: 'github-actions[bot]'
6763
user_email: 'github-actions[bot]@users.noreply.github.com'
64+
commit_message: "Nightly ${{ env.SHORT_SHA }}"
6865

6966
- name: Update nightly tag
7067
run: |
71-
git tag -f nightly "${GITHUB_SHA}"
72-
git push origin refs/tags/nightly --force
68+
git tag -f nightly
69+
git push origin nightly --force
7370
7471
- name: Publish nightly release
7572
uses: softprops/action-gh-release@v2
7673
with:
7774
tag_name: nightly
78-
target_commitish: ${{ github.sha }}
79-
name: ${{ steps.nightly_meta.outputs.label }}
80-
body: ${{ steps.nightly_meta.outputs.label }}
75+
name: Nightly ${{ env.SHORT_SHA }}
8176
prerelease: true
8277
make_latest: false
8378
files: |
8479
${{ steps.package.outputs.curseforge_zip }}
8580
${{ steps.package_server.outputs.server_zip }}
8681
overwrite_files: true
8782
fail_on_unmatched_files: true
83+
generate_release_notes: true
8884

8985
- name: Upload nightly artifacts
9086
uses: actions/upload-artifact@v4
9187
with:
92-
name: ${{ steps.nightly_meta.outputs.artifact_name }}
88+
name: "${{ env.SLUG }}-nightly-${{ env.SHORT_SHA }}"
9389
path: |
9490
${{ steps.package.outputs.curseforge_zip }}
9591
${{ steps.package_server.outputs.server_zip }}

.github/workflows/release.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ name: Release Modpack Build
22

33
on:
44
push:
5+
tags:
6+
- 'v*'
57

68
env:
79
MANIFEST_REPO: GregTechLite/gregtechlite.github.io
@@ -37,6 +39,14 @@ jobs:
3739
- name: Resolve metadata
3840
run: bash .github/scripts/meta.sh
3941

42+
- name: Validate release tag
43+
run: |
44+
expected_tag="v${VERSION}"
45+
if [ "${GITHUB_REF_NAME}" != "${expected_tag}" ]; then
46+
echo >&2 "Tag ${GITHUB_REF_NAME} does not match pack version ${expected_tag}"
47+
exit 1
48+
fi
49+
4050
- name: Prepare manifest
4151
run: bash .github/scripts/manifest.sh
4252

@@ -58,18 +68,16 @@ jobs:
5868
destination_dir: releases/${{ env.VERSION }}
5969
user_name: 'github-actions[bot]'
6070
user_email: 'github-actions[bot]@users.noreply.github.com'
71+
commit_message: "Release ${{ env.VERSION }}"
6172

6273
- name: Publish release
6374
uses: softprops/action-gh-release@v2
6475
with:
65-
tag_name: "v${{ env.VERSION }}"
66-
target_commitish: ${{ github.sha }}
6776
name: Release ${{ env.VERSION }}
68-
body: Release ${{ env.VERSION }}
6977
prerelease: false
7078
make_latest: true
7179
files: |
7280
${{ steps.package.outputs.curseforge_zip }}
7381
${{ steps.package_server.outputs.server_zip }}
74-
overwrite_files: true
7582
fail_on_unmatched_files: true
83+
generate_release_notes: true

0 commit comments

Comments
 (0)