edit workflows #13
This file contains 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: release | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build-apk: | |
permissions: | |
contents: write | |
name: Build APK | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v3 | |
- name: Setup java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: '17' | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20.x | |
- name: Install app dependencies | |
run: npm install | |
- name: Build Svelte app | |
run: npm run build | |
- name: Capacitor update | |
run: npx cap sync android | |
- name: Capacitor copy | |
run: npx cap copy | |
- name: Build app bundle | |
run: cd android && ./gradlew bundle && ./gradlew assemble | |
- name: Extract Android signing key from env | |
run: | | |
echo "${{ secrets.RELEASE_KEYSTORE }}" > android/release.jks.base64 | |
base64 -d android/release.jks.base64 > android/release.decrypted.jks | |
- name: get-npm-version | |
id: package-version | |
uses: martinbeentjes/[email protected] | |
- name: Sign dev build | |
run: jarsigner -keystore android/release.decrypted.jks -storepass "${{ secrets.RELEASE_KEYSTORE_PASSWORD }}" -signedjar ./android/app/build/outputs/bundle/release/nutstash-${{ steps.package-version.outputs.current-version}}.aab ./android/app/build/outputs/bundle/release/app-release.aab app.nutstash.key | |
- name: Release with Notes | |
run: | | |
mv ./android/app/build/outputs/apk/release/app-release-unsigned.apk ./android/app/build/outputs/apk/release/nutstash-${{ steps.package-version.outputs.current-version}}.apk | |
- name: create-release | |
uses: softprops/action-gh-release@v1 | |
with: | |
name: ${{ steps.package-version.outputs.current-version}} | |
tag_name: ${{ steps.package-version.outputs.current-version}} | |
files: | | |
android/app/build/outputs/apk/release/nutstash-${{ steps.package-version.outputs.current-version}}.apk | |
android/app/build/outputs/bundle/release/nutstash-${{ steps.package-version.outputs.current-version}}.aab | |
outputs: | |
releaseId: ${{ steps.create-release.outputs.id }} | |
build-native: | |
needs: build-apk | |
permissions: | |
contents: write | |
strategy: | |
fail-fast: false | |
matrix: | |
settings: | |
- platform: 'macos-latest' # for Arm based macs (M1 and above). | |
args: '--target aarch64-apple-darwin' | |
- platform: 'macos-latest' # for Intel based macs. | |
args: '--target x86_64-apple-darwin' | |
- platform: 'ubuntu-22.04' # for Tauri v1 you could replace this with ubuntu-20.04. | |
args: '' | |
- platform: 'windows-latest' | |
args: '' | |
runs-on: ${{ matrix.settings.platform }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
- name: install Rust stable | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
# Those targets are only used on macos runners so it's in an `if` to slightly speed up windows and linux builds. | |
targets: ${{ matrix.settings.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }} | |
- name: install dependencies (ubuntu only) | |
if: matrix.settings.platform == 'ubuntu-22.04' # This must match the platform value defined above. | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf | |
# webkitgtk 4.0 is for Tauri v1 - webkitgtk 4.1 is for Tauri v2. | |
# You can remove the one that doesn't apply to your app to speed up the workflow a bit. | |
- name: install frontend dependencies | |
run: npm install # change this to npm, pnpm or bun depending on which one you use. | |
- uses: tauri-apps/tauri-action@v0 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
releaseId: ${{ needs.build-apk.outputs.releaseId }} | |
args: ${{ matrix.settings.args }} | |
checksum: | |
needs: build-native | |
runs-on: ubuntu-latest | |
steps: | |
- uses: MCJack123/ghaction-generate-release-hashes@v3 | |
with: | |
file-name: checksum.txt | |
- uses: softprops/action-gh-release@v1 | |
with: | |
files: checksum.txt |