Update readme #46
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: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: write | |
jobs: | |
trigger-test: | |
uses: ./.github/workflows/test.yml | |
release: | |
strategy: | |
matrix: | |
include: | |
- platform: web | |
os: ubuntu-latest | |
build-folder: build | |
build-artifact: web | |
environment: onrender | |
- platform: macos | |
os: macos-latest | |
build-folder: build/macos/Build/Products/Release | |
build-artifact: sourdoc.app | |
- platform: linux | |
os: ubuntu-latest | |
build-folder: build/linux/x64/release | |
build-artifact: bundle | |
- platform: windows | |
os: windows-latest | |
build-folder: build/windows/x64/runner | |
build-artifact: release | |
name: release-${{ matrix.platform }} | |
concurrency: build-${{ github.ref }}-${{ matrix.platform }} | |
runs-on: ${{ matrix.os }} | |
needs: trigger-test | |
environment: ${{ matrix.environment }} | |
steps: | |
- 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.platform != 'windows' }} | |
run: | | |
echo "VERSION=$(cat VERSION)" >> $GITHUB_ENV | |
echo "ARTIFACT_NAME=${{ matrix.platform }}-sourdoc-v$(cat VERSION)" >> $GITHUB_ENV | |
- name: '[windows] Set environment variables' | |
if: ${{ matrix.platform == 'windows' }} | |
run: | | |
echo "VERSION=$(cat VERSION)" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append | |
echo "ARTIFACT_NAME=${{ matrix.platform }}-sourdoc-v$(cat VERSION)" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append | |
- name: '[linux] Install dependencies' | |
if: ${{ matrix.platform == 'linux' }} | |
run: sudo apt-get install clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev libstdc++-12-dev | |
- name: Build release | |
run: flutter build -v ${{ matrix.platform }} --release --build-name=${{ env.VERSION }} --build-number=${{ github.sha }} --dart-define=VERSION=${{ env.VERSION }} --dart-define=COMMIT_SHA=${{ github.sha }} --dart-define=REPO_URL=${{ github.server_url }}/${{ github.repository }} | |
- name: '[web] Trigger deploy on Render' | |
if: ${{ matrix.platform == '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 |