GitHub Workflows

This commit is contained in:
Win 2024-02-17 07:50:49 +07:00
parent 6b225685ef
commit 712827d57b
6 changed files with 335 additions and 0 deletions

58
.github/workflows/android.yml vendored Normal file
View File

@ -0,0 +1,58 @@
name: "Android Build"
on:
push:
tags: ['v*']
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
timeout-minutes: 25
steps:
- name: "Code Checkout"
uses: actions/checkout@v3
- name: "Java Setup"
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '11'
- name: "Install Missing Packages"
run: sudo apt-get update -y && sudo apt-get install -y ninja-build libgtk-3-dev
- name: "Flutter Action"
uses: subosito/flutter-action@v2.12.0
with:
flutter-version: '3.16.9'
channel: 'stable'
- name: "Flutter: Doctor"
run: flutter doctor
- name: "Flutter: Get Packages"
run: flutter pub get
- name: Create key.properties
run: |
echo "storeFile=${{ steps.android_keystore.outputs.filePath }}" > android/key.properties
echo "storePassword=${{ secrets.ANDROID_KEYSTORE_PASSWORD }}" >> android/key.properties
echo "keyPassword=${{ secrets.ANDROID_KEY_PASSWORD }}" >> android/key.properties
echo "keyAlias=${{ secrets.ANDROID_KEY_ALIAS }}" >> android/key.properties
- name: "Flutter: Build Android APK"
run: flutter build apk
- name: "Flutter: Build Android AppBundle"
run: flutter build appbundle
- name: Release to GitHub
uses: ncipollo/release-action@v1
with:
artifacts: "build/app/outputs/flutter-apk/app-release.apk,build/app/outputs/bundle/release/app-release.aab"
tag: ${{ steps.version.outputs.content }}
commit: ${{ github.sha }}
allowUpdates: true

78
.github/workflows/linux-arm.yml vendored Normal file
View File

@ -0,0 +1,78 @@
name: "Linux ARM Build"
on:
push:
tags: ['v*']
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
timeout-minutes: 25
steps:
- name: "Code Checkout"
uses: actions/checkout@v3
- name: "Java Setup"
uses: actions/setup-java@v2
with:
distribution: "zulu"
java-version: "11"
- name: Build Linux (arm64)
uses: uraimo/run-on-arch-action@v2
with:
arch: aarch64
distro: ubuntu_latest
githubToken: ${{ github.token }}
setup: |
mkdir -p "${PWD}/AppDir"
dockerRunArgs: |
--volume "${PWD}/AppDir:/AppDir"
install: |
echo Installing dependencies
apt-get update -qq -y
apt-get install -qq -y \
sudo \
bash curl file git unzip xz-utils zip \
clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev libstdc++-12-dev \
libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev gstreamer1.0-plugins-good
echo Installing Flutter
git clone https://github.com/flutter/flutter.git -b stable --depth 1 /opt/flutter
/opt/flutter/bin/flutter doctor -v
run: |
echo Creating non-root user
useradd -m nonroot
chown -R nonroot /opt/flutter
chown -R nonroot .
echo Building
sudo -u nonroot /opt/flutter/bin/flutter build linux --target-platform linux-arm64
mv build/linux/arm64/release/bundle/* /AppDir/
chown -R nonroot /AppDir/
chmod -R a+rw /AppDir/
chmod +x /AppDir/dateapp
- name: Compress Flutter build
id: compress
run: |
archiveName="dateapp-linux-arm64.tar.gz"
echo "archiveName=$archiveName" >> $GITHUB_OUTPUT
sudo chown -R $USER:$USER .
tar -C AppDir -czf $archiveName .
- name: Release to GitHub
uses: ncipollo/release-action@v1
with:
artifacts: "dateapp-linux-arm64.tar.gz"
tag: ${{ steps.version.outputs.content }}
commit: ${{ github.sha }}
allowUpdates: true

50
.github/workflows/linux-x86.yml vendored Normal file
View File

@ -0,0 +1,50 @@
name: "Linux x86_64"
on:
push:
tags: ['v*']
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
timeout-minutes: 25
steps:
- name: "Code Checkout"
uses: actions/checkout@v3
- name: "Java Setup"
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '11'
- name: "Install Missing Packages"
run: sudo apt-get update -y && sudo apt-get install -y ninja-build libgtk-3-dev
- name: "Flutter Action"
uses: subosito/flutter-action@v2.12.0
with:
flutter-version: '3.16.9'
channel: 'stable'
- name: "Flutter: Doctor"
run: flutter doctor
- name: "Flutter: Get Packages"
run: flutter pub get
- name: "Linux: Build for Linux"
run: flutter build linux
- name: "Linux: Tar Linux package"
run: tar -C build/linux/x64/release/bundle -czf dateapp-linux-x64.tar.gz .
- name: Release to GitHub
uses: ncipollo/release-action@v1
with:
artifacts: "dateapp-linux-x64.tar.gz"
tag: ${{ steps.version.outputs.content }}
commit: ${{ github.sha }}
allowUpdates: true

47
.github/workflows/macos.yml vendored Normal file
View File

@ -0,0 +1,47 @@
name: "MacOS - Build"
on:
push:
tags: ['v*']
jobs:
build:
runs-on: macos-latest
permissions:
contents: write
steps:
- name: "Code Checkout"
uses: actions/checkout@v3
- name: "Flutter Action"
uses: subosito/flutter-action@v2
with:
channel: 'stable'
architecture: x64
- name: BUILD_VERSION Env (stable)
if: ${{ inputs.channel == 'stable' }}
run: |
echo "BUILD_VERSION=${{ inputs.version }}" >> $GITHUB_ENV
- name: "Flutter: Enable MacOS Desktop"
run: flutter config --enable-macos-desktop
- name: "Flutter: Build MacOS"
run: flutter build macos
- name: Package MacOS App
run: |
python3 -m pip install setuptools
npm install -g appdmg
mkdir -p build/${{ env.BUILD_VERSION }}
appdmg appdmg.json build/dateapp-macos-universal.dmg
- name: Release to GitHub
uses: ncipollo/release-action@v1
with:
artifacts: "build/dateapp-macos-universal.dmg"
tag: ${{ steps.version.outputs.content }}
commit: ${{ github.sha }}
allowUpdates: true

63
.github/workflows/web.yml vendored Normal file
View File

@ -0,0 +1,63 @@
name: Publish to GitHub Pages
on:
workflow_dispatch:
push:
branches: [ main ]
permissions:
contents: read
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup cache
uses: actions/cache@v3
with:
path: |
build
key: ${{ runner.OS }}-dateapp-ubuntu-${{ hashFiles('**/pubspec.lock') }}-${{ hashFiles('**/*.dart') }}
restore-keys: |
${{ runner.OS }}-dateapp-ubuntu-
- name: Install Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
cache: true
cache-key: 'flutter-:os:-:channel:-:version:-:arch:'
- name: Build web
run: flutter build web --release --web-renderer=canvaskit
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: build/web
deploy:
needs: build
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
# Specify runner + deployment step
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

39
.github/workflows/windows.yml vendored Normal file
View File

@ -0,0 +1,39 @@
name: "Windows - Build"
on:
push:
tags: ['v*']
jobs:
build:
runs-on: windows-latest
permissions:
contents: write
steps:
- name: "Code Checkout"
uses: actions/checkout@v3
- name: "Flutter Action"
uses: subosito/flutter-action@v2
with:
channel: 'beta'
- name: Generating Secrets
run: |
flutter config --enable-windows-desktop
flutter pub get
- name: Build Windows Executable
run: |
dart pub global activate flutter_distributor
make innoinstall
flutter_distributor package --platform=windows --targets=exe --skip-clean
mv dist/**/dateapp-*-windows-setup.exe dist/dateapp-windows-x86_64-setup.exe
- name: Release to GitHub
uses: ncipollo/release-action@v1
with:
artifacts: "dist/dateapp-windows-x86_64-setup.exe"
tag: ${{ steps.version.outputs.content }}
commit: ${{ github.sha }}
allowUpdates: true