Skip to content

Release

Release #419

Workflow file for this run

name: Release
on:
workflow_dispatch:
inputs:
send_fcm:
description: 'Send FCM push notification'
type: boolean
default: true
push:
branches:
- main
jobs:
release:
name: Release
permissions:
contents: write
packages: write
id-token: write
attestations: write
actions: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup Java
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: '21'
- name: Cache Gradle
uses: burrunan/gradle-cache-action@v3
- name: Setup keystore
run: |
echo "${{ secrets.KEYSTORE_B64 }}" | base64 -d > app/keystore.jks
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: "lts/*"
cache: npm
- name: Install dependencies
run: npm ci
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
fingerprint: ${{ vars.GPG_FINGERPRINT }}
- name: Release
uses: cycjimmy/semantic-release-action@v5
id: release
env:
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
KEYSTORE_ENTRY_ALIAS: ${{ secrets.KEYSTORE_ENTRY_ALIAS }}
KEYSTORE_ENTRY_PASSWORD: ${{ secrets.KEYSTORE_ENTRY_PASSWORD }}
- name: Attest
if: steps.release.outputs.new_release_published == 'true'
uses: actions/attest-build-provenance@v2
with:
subject-name: 'Morphe Manager ${{ steps.release.outputs.new_release_git_tag }}'
subject-path: app/build/outputs/apk/release/morphe-manager*.apk
- name: Generate website deploy token
if: steps.release.outputs.new_release_published == 'true'
id: app-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ vars.MORPHE_AAMATT_APP_ID }}
private-key: ${{ secrets.WEBSITE_DISPATCH_TOKEN }}
owner: MorpheApp
- name: Trigger website deploy
if: steps.release.outputs.new_release_published == 'true'
uses: actions/github-script@v7
with:
github-token: ${{ steps.app-token.outputs.token }}
script: |
await github.rest.repos.createDispatchEvent({
owner: 'MorpheApp',
repo: 'morphe-website',
event_type: 'trigger-deploy'
})
- name: Wait before sending FCM
if: steps.release.outputs.new_release_published == 'true' && (github.event_name == 'push' || inputs.send_fcm == true)
run: sleep 480
- name: Setup Python for FCM
if: steps.release.outputs.new_release_published == 'true' && (github.event_name == 'push' || inputs.send_fcm == true)
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Send FCM push notification
if: steps.release.outputs.new_release_published == 'true' && (github.event_name == 'push' || inputs.send_fcm == true)
env:
FCM_PROJECT_ID: ${{ secrets.FCM_PROJECT_ID }}
FCM_SERVICE_ACCOUNT_JSON: ${{ secrets.FCM_SERVICE_ACCOUNT_JSON }}
NEW_TAG: ${{ steps.release.outputs.new_release_git_tag }}
BRANCH: ${{ github.ref_name }}
run: |
pip install cryptography
python3 .github/scripts/send_fcm.py