Skip to content

Update release build arg naming #68

Update release build arg naming

Update release build arg naming #68

Workflow file for this run

name: Release
on:
workflow_dispatch:
push:
branches:
- main
permissions:
contents: write
jobs:
trigger-test:
uses: ./.github/workflows/test.yml
release:
strategy:
matrix:
include:
- build: web
os: ubuntu-latest
build-folder: build
build-artifact: web
environment: onrender
- build: appbundle
os: ubuntu-latest
build-folder: build/app/outputs/bundle/release
build-artifact: app-release.aab
- build: macos
os: macos-latest
build-folder: build/macos/Build/Products/Release
build-artifact: sourdoc.app
- build: linux
os: ubuntu-latest
build-folder: build/linux/x64/release
build-artifact: bundle
- build: windows
os: windows-latest
build-folder: build/windows/x64/runner
build-artifact: release
name: release-${{ matrix.build }}
concurrency: build-${{ github.ref }}-${{ matrix.build }}
runs-on: ${{ matrix.os }}
needs: trigger-test
environment: ${{ matrix.environment }}
steps:
- name: '[appbundle] Setup java'
if: ${{ matrix.build == 'appbundle' }}
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: '[appbundle] Setup android sdk'
if: ${{ matrix.build == 'appbundle' }}
uses: android-actions/setup-android@v3
- name: Prepare flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ vars.FLUTTER_VERSION }}
channel: ${{ vars.FLUTTER_CHANNEL }}
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Set environment variables
if: ${{ matrix.build != 'windows' }}
run: |
echo "VERSION=$(cat VERSION)" >> $GITHUB_ENV
echo "ARTIFACT_NAME=${{ matrix.build }}-sourdoc-v$(cat VERSION)" >> $GITHUB_ENV
- name: '[windows] Set environment variables'
if: ${{ matrix.build == 'windows' }}
run: |
echo "VERSION=$(cat VERSION)" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
echo "ARTIFACT_NAME=${{ matrix.build }}-sourdoc-v$(cat VERSION)" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
- name: '[linux] Install dependencies'
if: ${{ matrix.build == 'linux' }}
run: sudo apt-get install clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev libstdc++-12-dev
- name: '[appbundle] Setup upload keystore'
if: ${{ matrix.build == 'appbundle' }}
run: |
echo "${{ secrets.ANDROID_UPLOAD_KEYSTORE_ASC }}" > $HOME/upload-keystore.jks.asc
gpg -d --passphrase "${{ secrets.ANDROID_UPLOAD_KEYSTORE_ASC_PASSPHRASE }}" --batch $HOME/upload-keystore.jks.asc > $HOME/upload-keystore.jks
echo -e "storePassword=${{ secrets.ANDROID_UPLOAD_KEYSTORE_PASSWORD }}\nkeyPassword=${{ secrets.ANDROID_UPLOAD_KEYSTORE_PASSWORD }}\nkeyAlias=upload\nstoreFile=$HOME/upload-keystore.jks" > android/key.properties
- name: Build release
run: flutter build -v ${{ matrix.build }} --release --build-name=${{ env.VERSION }} --build-number=${{ matrix.build == 'appbundle' && 1 || github.sha }} --dart-define=VERSION=${{ env.VERSION }} --dart-define=COMMIT_SHA=${{ github.sha }} --dart-define=REPO_URL=${{ github.server_url }}/${{ github.repository }} ${{ matrix.build == 'web' && '--csp' || '' }}
- name: '[web] Trigger deploy on Render'
if: ${{ matrix.build == 'web' }}
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: ${{ matrix.build-folder }}/${{ matrix.build-artifact }}
branch: onrender
- name: 'Compress build'
run: |
cd ${{ matrix.build-folder }}
tar -czf ${{ env.ARTIFACT_NAME }}.tgz ${{ matrix.build-artifact }}
- name: 'Upload build artifact'
uses: actions/upload-artifact@v3
with:
name: ${{ env.ARTIFACT_NAME }}
path: ${{ matrix.build-folder }}/${{ env.ARTIFACT_NAME }}.tgz
if-no-files-found: error
create-github-release:
concurrency: release-${{ github.ref }}
runs-on: ubuntu-latest
needs: release
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Set version environment variable
run: echo "VERSION=$(cat VERSION)" >> $GITHUB_ENV
- name: Download all artifacts
uses: actions/download-artifact@v3
with:
path: artifacts
- name: Create release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ env.VERSION }}
files: |
artifacts/**/*
fail_on_unmatched_files: true
monitor-web-deploy:
needs: release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Check deployment status
run: COMMIT=$(git rev-parse HEAD) bash cli/web_deploy_monitor.sh