yubioath-flutter/.github/workflows/macos.yml

102 lines
2.8 KiB
YAML
Raw Normal View History

2021-11-19 11:22:27 +03:00
name: macOS
on: [push, pull_request]
jobs:
build:
runs-on: macos-latest
2021-11-19 11:22:27 +03:00
steps:
- uses: actions/checkout@v4
2021-11-19 11:22:27 +03:00
- name: Read variables from repo
run: cat .github/workflows/env >> $GITHUB_ENV
- name: Check app versions
run: |
2022-11-24 18:33:37 +03:00
python3 set-version.py
git diff --exit-code
2023-11-29 12:41:45 +03:00
- name: Set up Python
2023-12-12 13:06:27 +03:00
uses: actions/setup-python@v5
2023-11-29 12:41:45 +03:00
with:
python-version: ${{ env.PYVER }}
2023-12-08 18:04:13 +03:00
- name: Set up CocoaPods
uses: maxim-lobanov/setup-cocoapods@v1
with:
podfile-path: macos/Podfile.lock
2022-11-24 18:33:37 +03:00
- name: Cache helper
id: cache-helper
uses: actions/cache@v3
with:
path: |
build/macos/helper
assets/licenses/helper.json
key: ${{ runner.os }}-py${{ env.PYVER }}-${{ hashFiles('helper/**') }}
2021-11-19 11:22:27 +03:00
- name: Install dependencies
2022-11-24 18:33:37 +03:00
if: steps.cache-helper.outputs.cache-hit != 'true'
2021-11-19 11:22:27 +03:00
run: |
brew update
brew install swig
python -m pip install --upgrade pip
pip install poetry
2022-11-24 18:33:37 +03:00
- name: Build the Helper
if: steps.cache-helper.outputs.cache-hit != 'true'
run: ./build-helper.sh
- uses: subosito/flutter-action@v2
2021-11-19 11:22:27 +03:00
with:
2022-05-12 09:36:47 +03:00
channel: 'stable'
architecture: 'x64'
flutter-version: ${{ env.FLUTTER }}
2021-11-19 11:22:27 +03:00
- run: flutter config --enable-macos-desktop
- run: flutter --version
2023-11-29 12:41:45 +03:00
- name: Run lints/tests
2023-11-30 19:48:04 +03:00
env:
SKIP: ${{ steps.cache-helper.outputs.cache-hit == 'true' && 'mypy,flake8,black,bandit' || ''}}
run: |
2023-11-30 19:48:04 +03:00
pip install pre-commit
pre-commit run --all-files
flutter test
2021-11-19 12:23:01 +03:00
2021-11-19 11:22:27 +03:00
- name: Build the app
run: |
export VERSION_NAME=`./set-version.py | head -n 1 | sed 's/-.*$//g'`
flutter build macos --build-name=$VERSION_NAME
2021-11-19 11:22:27 +03:00
- name: Check generated files
run: git diff --exit-code
2022-06-23 15:31:36 +03:00
- name: Create dmg
run: |
brew install create-dmg
mkdir source_folder
cp -R build/macos/Build/Products/Release/"Yubico Authenticator.app" source_folder
2022-11-10 13:48:39 +03:00
cp resources/icons/dmg-background.png .
2022-06-28 16:47:19 +03:00
sh create-dmg.sh
2022-06-23 15:31:36 +03:00
2021-11-19 11:22:27 +03:00
- name: Rename and archive app bundle
run: |
export REF=$(echo ${GITHUB_REF} | cut -d '/' -f 3)
mkdir deploy
2022-06-23 15:31:36 +03:00
mv yubioath-desktop.dmg deploy
tar -czf deploy/yubioath-desktop-${REF}.app.tar.gz -C build/macos/Build/Products/Release "Yubico Authenticator.app"
2022-11-10 13:48:39 +03:00
mv create-dmg.sh deploy
mv resources/icons/dmg-background.png deploy
2022-11-10 17:17:30 +03:00
mv macos/helper.entitlements deploy
mv macos/helper-sandbox.entitlements deploy
mv macos/Runner/Release.entitlements deploy
mv macos/release-macos.sh deploy
2021-11-19 11:22:27 +03:00
- name: Upload artifact
uses: actions/upload-artifact@v4
2021-11-19 11:22:27 +03:00
with:
name: yubioath-desktop-macos
path: deploy