Skip to content

Commit 3a61d0c

Browse files
committed
Update Workflow
1 parent 0cf896f commit 3a61d0c

2 files changed

Lines changed: 26 additions & 12 deletions

File tree

.github/workflows/release.yml

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,40 @@ jobs:
2020
- name: Set environment variables
2121
run: |
2222
set -euo pipefail
23-
SHORT_SHA="${GITHUB_SHA:0:7}"
24-
echo "SHORT_SHA=$SHORT_SHA" >> $GITHUB_ENV
25-
26-
VERSION="v-$(date -u +%Y%m%d%H%M%S)-${SHORT_SHA}"
27-
echo "INJECTED_VERSION=$VERSION" >> $GITHUB_ENV
28-
29-
# Update JAR name to include the version
30-
JAR_NAME="btw-translations-$VERSION.jar"
23+
# Always use the same JAR name
24+
JAR_NAME="btw-translation.jar"
3125
echo "JAR_NAME=$JAR_NAME" >> $GITHUB_ENV
3226
27+
# Human-readable nightly release title
28+
NIGHTLY_DATE=$(date -u +"%b %dth %Y")
29+
RELEASE_TITLE="BTW Translations Nightly $NIGHTLY_DATE"
30+
echo "RELEASE_TITLE=$RELEASE_TITLE" >> $GITHUB_ENV
31+
3332
- name: Inject version into fabric.mod.json
3433
run: |
3534
set -euo pipefail
35+
# Read current version from fabric.mod.json
36+
CURRENT_VERSION=$(jq -r '.version' fabric.mod.json)
37+
echo "Current version: $CURRENT_VERSION"
38+
39+
# Extract major and minor parts (e.g., 1.0 from 1.0.0-dev)
40+
MAJOR_MINOR=$(echo "$CURRENT_VERSION" | sed -E 's/^([0-9]+\.[0-9]+).*/\1/')
41+
42+
# Use GitHub run number as patch
43+
PATCH="$GITHUB_RUN_NUMBER"
44+
45+
# Construct new version: 1.0.X
46+
INJECTED_VERSION="${MAJOR_MINOR}.${PATCH}"
47+
echo "INJECTED_VERSION=$INJECTED_VERSION" >> $GITHUB_ENV
48+
49+
# Update fabric.mod.json with new version
3650
jq --arg v "$INJECTED_VERSION" '.version = $v' fabric.mod.json > fabric.mod.json.tmp
3751
mv fabric.mod.json.tmp fabric.mod.json
3852
3953
- name: Create JAR of repository
4054
run: |
4155
set -euo pipefail
42-
# Build JAR safely, excluding .git, .github, and .gitignore
56+
# Build JAR excluding .git, .github, and .gitignore
4357
find . -type f \
4458
! -path "./.git/*" \
4559
! -path "./.github/*" \
@@ -53,8 +67,8 @@ jobs:
5367
run: |
5468
set -euo pipefail
5569
TAG="$INJECTED_VERSION"
56-
TITLE="BTW CE Translations $TAG"
57-
NOTES="Automated release for commit ${GITHUB_SHA} on branch ${GITHUB_REF#refs/heads/}"
70+
TITLE="$RELEASE_TITLE"
71+
NOTES="Automated nightly release for commit ${GITHUB_SHA} on branch ${GITHUB_REF#refs/heads/}"
5872
5973
gh release create "$TAG" "$JAR_NAME" \
6074
-t "$TITLE" \

fabric.mod.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"schemaVersion": 1,
33
"id": "translation",
4-
"version": "3.0.0",
4+
"version": "1.0.0-dev",
55
"name": "Translation Addon",
66
"description": "BTW CE Fan Translations",
77
"authors": [

0 commit comments

Comments
 (0)