fixing tiny german translation oopsies (#5) #14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Package and Release JAR | |
| on: | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: write | |
| jobs: | |
| jar-and-release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set environment variables | |
| run: | | |
| set -euo pipefail | |
| # Always use the same JAR name | |
| JAR_NAME="btw-translations.jar" | |
| echo "JAR_NAME=$JAR_NAME" >> $GITHUB_ENV | |
| - name: Inject version into fabric.mod.json | |
| run: | | |
| set -euo pipefail | |
| # Read current version from fabric.mod.json | |
| CURRENT_VERSION=$(jq -r '.version' fabric.mod.json) | |
| echo "Current version: $CURRENT_VERSION" | |
| # Extract major and minor parts (e.g., 1.0 from 1.0.0-dev) | |
| MAJOR_MINOR=$(echo "$CURRENT_VERSION" | sed -E 's/^([0-9]+\.[0-9]+).*/\1/') | |
| # Use GitHub run number as patch | |
| PATCH="$GITHUB_RUN_NUMBER" | |
| # Construct new version: 1.0.X | |
| INJECTED_VERSION="${MAJOR_MINOR}.${PATCH}" | |
| echo "INJECTED_VERSION=$INJECTED_VERSION" >> $GITHUB_ENV | |
| # Update fabric.mod.json with new version | |
| jq --arg v "$INJECTED_VERSION" '.version = $v' fabric.mod.json > fabric.mod.json.tmp | |
| mv fabric.mod.json.tmp fabric.mod.json | |
| # Set release title using version | |
| RELEASE_TITLE="BTW Translations Nightly $INJECTED_VERSION" | |
| echo "RELEASE_TITLE=$RELEASE_TITLE" >> $GITHUB_ENV | |
| - name: Create JAR of repository | |
| run: | | |
| set -euo pipefail | |
| # Build JAR excluding .git, .github, and .gitignore | |
| find . -type f \ | |
| ! -path "./.git/*" \ | |
| ! -path "./.github/*" \ | |
| ! -name ".gitignore" \ | |
| ! -name "$JAR_NAME" \ | |
| -print0 | xargs -0 jar cf "$JAR_NAME" | |
| - name: Create GitHub release and attach JAR | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| set -euo pipefail | |
| TAG="$INJECTED_VERSION" | |
| TITLE="$RELEASE_TITLE" | |
| NOTES="Automated nightly release for commit ${GITHUB_SHA} on branch ${GITHUB_REF#refs/heads/}" | |
| gh release create "$TAG" "$JAR_NAME" \ | |
| -t "$TITLE" \ | |
| -n "$NOTES" \ | |
| --repo "${{ github.repository }}" | |
| echo "Created release $TAG with asset $JAR_NAME" |