Hotfix: Fix MacOS build action #23
Workflow file for this run
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
# Build the app for Windows, Linux and macOS | |
name: build | |
on: | |
push: | |
tags: | |
- 'v*' | |
jobs: | |
# Build for Windows | |
windows: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up flutter environment | |
uses: subosito/flutter-action@v1 # v2 struggles reading version | |
with: | |
flutter-version: '3.7.x' | |
channel: 'stable' | |
- name: Resolve dependecies | |
run: | | |
cd flutter_app | |
flutter pub get | |
- name: Build for Windows | |
run: | | |
cd flutter_app | |
flutter config --enable-windows-desktop | |
flutter build windows --release | |
- name: Create Setup.exe to upload | |
run: | | |
& 'C:\Program Files (x86)\Inno Setup 6\ISCC.exe' .\flutter_app\install\windows\setupscript.iss | |
shell: powershell | |
- name: Pack bundle to artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: FileTreeHasher-windows-x64 | |
path: .\flutter_app\install\windows\FileTreeHasher-Setup.exe | |
if-no-files-found: error | |
# Build for Linux | |
linux: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install necessary packages | |
run: | | |
sudo apt update -y | |
sudo apt install -y cmake clang ninja-build libgtk-3-dev jq | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up flutter environment | |
uses: subosito/flutter-action@v1 # v2 struggles reading version | |
with: | |
flutter-version: '3.7.x' | |
channel: 'stable' | |
- name: Resolve dependecies | |
run: | | |
cd flutter_app | |
flutter pub get | |
- name: Build for Linux | |
run: | | |
cd flutter_app | |
flutter config --enable-linux-desktop | |
flutter build linux --release | |
- name: Create install folder to upload | |
run: | | |
mkdir ./FileTreeHasher-linux-x64 | |
mv flutter_app/build/linux/x64/release/bundle ./FileTreeHasher-linux-x64/ | |
cp flutter_app/install/linux/install.sh ./FileTreeHasher-linux-x64/ | |
- name: Pack bundle to artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: FileTreeHasher-linux-x64 | |
path: ./FileTreeHasher-linux-x64/ | |
if-no-files-found: error | |
# Build for macOS | |
macos: | |
runs-on: macos-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up flutter environment | |
uses: subosito/flutter-action@v1 # v2 struggles reading version | |
with: | |
flutter-version: '3.7.x' | |
channel: 'stable' | |
- name: Resolve dependecies | |
run: | | |
cd flutter_app | |
flutter pub get | |
- name: Build for macOS | |
run: | | |
cd flutter_app | |
flutter config --enable-macos-desktop | |
flutter build macos --release | |
- name: Pack bundle to artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: FileTreeHasher-macos-x64 | |
path: flutter_app/build/macos/Build/Products/Release/File\ Tree\ Hasher.app/ | |
if-no-files-found: error | |
# Update page and deploy builds | |
website: | |
runs-on: ubuntu-latest | |
needs: [windows, linux, macos] | |
steps: | |
- name: Checkout repository on tag | |
uses: actions/checkout@v3 | |
- name: Get tag name | |
id: get-tag-name | |
run: echo "out=${{ github.ref_name }}" >> "$GITHUB_OUTPUT" | |
- name: Get tag message | |
id: get-tag-message | |
run: | | |
TAG_MSG=$(git tag -l --format='%(contents)' ${{ steps.get-tag-name.outputs.out }}) | |
echo "TAG_MSG<<EOF" >> $GITHUB_ENV | |
echo "$TAG_MSG" >> $GITHUB_ENV | |
echo "EOF" >> $GITHUB_ENV | |
- name: Download all artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
path: ../bundles | |
- name: Install zipping tool | |
uses: montudor/action-zip@v1 | |
- name: Zip all artifacts | |
run: | | |
zip -qq -r FileTreeHasher-linux-x64.zip FileTreeHasher-linux-x64/* | |
zip -qq -r FileTreeHasher-windows-x64.zip FileTreeHasher-windows-x64/* | |
zip -qq -r FileTreeHasher-macos-x64.zip FileTreeHasher-macos-x64/* | |
rm -r FileTreeHasher-linux-x64/ | |
rm -r FileTreeHasher-windows-x64/ | |
rm -r FileTreeHasher-macos-x64/ | |
working-directory: ../bundles | |
- name: Add download page for bundles | |
run: bash AddBundleDownload.sh "${{ steps.get-tag-name.outputs.out }}" ../../bundles "${{ env.TAG_MSG }}" | |
working-directory: ./website | |
- name: Buffer newly created website part | |
run: mv website/ ../ | |
- name: Checkout current gh-pages | |
uses: actions/checkout@v3 | |
with: | |
ref: gh-pages | |
- name: Buffer all historical downloads | |
run: | | |
mv assets/downloads/* ../website/assets/downloads/ | |
- name: Checkout repository on develop | |
uses: actions/checkout@v3 | |
with: | |
ref: develop | |
- name: Restore all buffered website (including downloads) | |
run: | | |
rm -r ./website/ | |
mv ../website/ . | |
- name: Push new website to develop (excluding downloads) | |
run: | | |
git config --global user.email "nilshenrich@web.de" | |
git config --global user.name "Nils Henrich - deploy workflow" | |
git add -- . ':!website/assets/downloads/' | |
git commit -m "<GitHub Action> Deploy version ${{ steps.get-tag-name.outputs.out }}" | |
git push origin | |
- name: Clean repository (only website to be left) | |
run: | | |
rm website/AddBundleDownload.sh | |
mv website/ ../ | |
git rm -rf . | |
git clean -fxd | |
mv ../website/* . | |
- name: Build website using jekyll | |
uses: helaili/jekyll-action@v2 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
target_branch: 'gh-pages' |