Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 0 additions & 71 deletions .github/workflows/release.yml

This file was deleted.

67 changes: 64 additions & 3 deletions .github/workflows/semantic-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,92 @@ concurrency:
cancel-in-progress: false

jobs:
determine-release:
name: Determine Release
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
new_release_published: ${{ steps.semantic-preview.outputs.new_release_published }}
new_release_version: ${{ steps.semantic-preview.outputs.new_release_version }}
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
with:
fetch-depth: 0
persist-credentials: false

- name: Setup Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
with:
node-version: '20'

- name: Semantic Release Preview
id: semantic-preview
uses: cycjimmy/semantic-release-action@16ca923e6ccbb50770c415a0ccd43709a8c5f7a4
with:
dry_run: true
extra_plugins: |
@semantic-release/changelog
@semantic-release/exec
@semantic-release/git
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}

semantic-release:
name: Semantic Release
needs: determine-release
if: needs.determine-release.outputs.new_release_published == 'true'
runs-on: ubuntu-latest
permissions:
contents: write
issues: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
with:
fetch-depth: 0
token: ${{ secrets.GH_TOKEN }}

- name: Set up JDK 17
uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9
with:
java-version: '17'
distribution: 'temurin'
cache: 'gradle'

- name: Setup Node.js
uses: actions/setup-node@v4
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
with:
node-version: '20'

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Decode and create termix.keystore
run: |
if [ -n "${{ secrets.KEYSTORE }}" ]; then
echo "${{ secrets.KEYSTORE }}" | base64 -d > /tmp/termix-keystore
fi

- name: Decode and create termix-signing.properties
run: |
if [ -n "${{ secrets.PROP }}" ]; then
echo "${{ secrets.PROP }}" | base64 -d > /tmp/termix-signing.properties
fi

- name: Semantic Release
uses: cycjimmy/semantic-release-action@v4
id: semantic
uses: cycjimmy/semantic-release-action@16ca923e6ccbb50770c415a0ccd43709a8c5f7a4
with:
extra_plugins: |
@semantic-release/changelog
@semantic-release/exec
@semantic-release/git
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}

- name: Clean up signing files
if: always()
run: rm -f /tmp/termix-keystore /tmp/termix-signing.properties
9 changes: 7 additions & 2 deletions .releaserc.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
[
"@semantic-release/exec",
{
"prepareCmd": "bash scripts/bump-version.sh ${nextRelease.version}"
"prepareCmd": "bash scripts/bump-version.sh ${nextRelease.version} && ./gradlew app:lintDebug testDebugUnitTest assembleRelease && bash scripts/prepare-release-apk.sh ${nextRelease.version}"
}
],
[
Expand All @@ -18,6 +18,11 @@
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
],
"@semantic-release/github"
[
"@semantic-release/github",
{
"assets": ["app/termix-v*.apk"]
}
]
]
}
25 changes: 25 additions & 0 deletions scripts/prepare-release-apk.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash
set -euo pipefail

VERSION="${1:-}"
if [ -z "$VERSION" ]; then
echo "Usage: $0 <version>" >&2
exit 1
fi

shopt -s nullglob
apks=(app/build/outputs/apk/release/*.apk)

if [ "${#apks[@]}" -eq 0 ]; then
echo "No release APK found under app/build/outputs/apk/release" >&2
exit 1
fi

if [ "${#apks[@]}" -ne 1 ]; then
echo "Expected exactly one release APK, found ${#apks[@]}" >&2
printf 'Matched files:\n' >&2
printf ' %s\n' "${apks[@]}" >&2
exit 1
fi

cp "${apks[0]}" "app/termix-v${VERSION}.apk"
Loading