Skip to content

Add version info to home #129

Add version info to home

Add version info to home #129

Workflow file for this run

name: Release
on:
workflow_dispatch:
push:
branches:
- main
paths-ignore:
- '.github/**'
- '!.github/workflows/release.yml'
- '!.github/workflows/test.yml'
- '.vscode/**'
- 'cli/**'
- '!cli/web_deploy_monitor.sh'
- 'docs/**'
- 'LICENSE'
- 'README.md'
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: apk
os: ubuntu-latest
build-folder: build/app/outputs/flutter-apk
build-artifact: app-release.apk
- 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: '[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 java'
if: ${{ matrix.build == 'appbundle' || matrix.build == 'apk' }}
uses: actions/setup-java@v3
with:
java-version: 17
distribution: temurin
- name: '[appbundle] Setup android sdk'
if: ${{ matrix.build == 'appbundle' || matrix.build == 'apk' }}
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' }}
id: env_vars
run: |
echo -e "VERSION=$(cat VERSION)\nBUILD_NUMBER=$(date +%s)\nARTIFACT_NAME=${{ matrix.build }}-sourdoc-v$(cat VERSION)" >> $GITHUB_ENV
- name: '[windows] Set environment variables'
if: ${{ matrix.build == 'windows' }}
run: |
echo "VERSION=$(cat VERSION)`nBUILD_NUMBER=$(date +%s)`nARTIFACT_NAME=${{ matrix.build }}-sourdoc-v$(cat VERSION)" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
- name: '[appbundle] Setup upload keystore'
if: ${{ matrix.build == 'appbundle' || matrix.build == 'apk' }}
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=${{ env.BUILD_NUMBER }}
--dart-define=VERSION=${{ env.VERSION }}
--dart-define=BUILD_NUMBER=${{ env.BUILD_NUMBER }}
--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: '[web] Monitor deployment status'
if: ${{ matrix.build == 'web' }}
run: BUILD_NUMBER=${{ env.BUILD_NUMBER }} bash cli/web_deploy_monitor.sh
- 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 environment variables
id: env_vars
run: |
echo -e "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