mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-10 15:11:58 +01:00
Replace the unpinned third-party upload-google-play action with fastlane supply from a small nix release devshell, and pin the remaining third-party GitHub release action to a commit SHA.
67 lines
2.7 KiB
YAML
67 lines
2.7 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "v*"
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
env:
|
|
NIX_CONFIG: experimental-features = nix-command flakes
|
|
|
|
jobs:
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 60
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: cachix/install-nix-action@13d8dd58da0234aa297dedd986986ccb8e7f3e24 # v31.11.1
|
|
- uses: nix-community/cache-nix-action@7df957e333c1e5da7721f60227dbba6d06080569 # v7
|
|
with:
|
|
primary-key: nix-v2-${{ hashFiles('flake.lock', '**/*.nix') }}
|
|
restore-prefixes-first-match: nix-v2-
|
|
- name: Decode signing material
|
|
id: signing
|
|
env:
|
|
KEYSTORE_BASE64: ${{ secrets.SUBTRACKS_KEYSTORE_BASE64 }}
|
|
KEYPROPERTIES_BASE64: ${{ secrets.SUBTRACKS_KEYPROPERTIES_BASE64 }}
|
|
run: |
|
|
echo "$KEYSTORE_BASE64" | base64 -d > "$RUNNER_TEMP/release.keystore"
|
|
alias=$(printf '%s' "$KEYPROPERTIES_BASE64" | base64 -d | sed -n 's/^keyAlias=//p' | tr -d '\r')
|
|
test -n "$alias" || { echo "no keyAlias found in SUBTRACKS_KEYPROPERTIES_BASE64" >&2; exit 1; }
|
|
echo "alias=$alias" >> "$GITHUB_OUTPUT"
|
|
- name: Build APK and bundle
|
|
env:
|
|
RELEASE_KEYSTORE: ${{ runner.temp }}/release.keystore
|
|
RELEASE_KEYSTORE_PASSWORD: ${{ secrets.SUBTRACKS_UPLOAD_STORE_PASSWORD }}
|
|
RELEASE_KEY_ALIAS: ${{ steps.signing.outputs.alias }}
|
|
RELEASE_KEY_PASSWORD: ${{ secrets.SUBTRACKS_UPLOAD_KEY_PASSWORD }}
|
|
run: nix develop --command gradle :app:assembleRelease :app:bundleRelease --no-daemon
|
|
- name: Read version code
|
|
id: version
|
|
run: echo "code=$(grep -oP 'versionCode = \K\d+' app/build.gradle.kts)" >> "$GITHUB_OUTPUT"
|
|
- name: Upload to Google Play
|
|
env:
|
|
PLAY_SERVICE_ACCOUNT_JSON: ${{ secrets.PLAY_SERVICE_ACCOUNT_JSON }}
|
|
run: |
|
|
nix develop .#release --command fastlane supply \
|
|
--aab app/build/outputs/bundle/release/app-release.aab \
|
|
--package_name com.subtracks \
|
|
--track "${{ vars.PLAY_TRACK || 'internal' }}" \
|
|
--release_status completed \
|
|
--json_key_data "$PLAY_SERVICE_ACCOUNT_JSON" \
|
|
--metadata_path metadata \
|
|
--skip_upload_metadata \
|
|
--skip_upload_images \
|
|
--skip_upload_screenshots \
|
|
--mapping app/build/outputs/mapping/release/mapping.txt
|
|
- name: Collect release APK
|
|
run: cp app/build/outputs/apk/release/app-release.apk subtracks.apk
|
|
- name: Create GitHub release
|
|
uses: softprops/action-gh-release@efb35369e0ad2afab669f228072c1b0d510eae64 # v3
|
|
with:
|
|
body_path: metadata/en-US/changelogs/${{ steps.version.outputs.code }}.txt
|
|
files: subtracks.apk
|