Skip to content

Quest indiv checks after update #1135

Quest indiv checks after update

Quest indiv checks after update #1135

name: Release
on:
push:
branches:
- main
- dev
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
workflow_dispatch:
env:
FLUTTER_VERSION: "3.24.3"
jobs:
create-build:
name: Create ${{ matrix.target }} build
runs-on: ${{ matrix.os }}
strategy:
matrix:
target: [windows, linux, android]
include:
# - os: macos-10.15 # Catalina
# target: macOS
# build_target: macos
# build_path: build/macos/Build/Products/Release
# asset_extension: .zip
# asset_content_type: application/zip
# build_options:
- os: windows-latest
target: windows
build_target: windows
build_path: build\windows\x64\runner\Release
asset_extension: .zip
asset_content_type: application/zip
build_options:
- os: ubuntu-latest
target: linux
build_target: linux
build_path: build/linux/x64/release/bundle
asset_extension: .tar.gz
asset_content_type: application/gzip
build_options:
- os: ubuntu-latest
target: android
build_target: apk
build_path: build/app/outputs
asset_extension: .apk
asset_content_type: application/vnd.android.package-archive
build_options: --flavor=play
fail-fast: false
steps:
- uses: subosito/flutter-action@v2
with:
channel: "stable"
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true
cache-key: flutter-${{ matrix.os }}-${{ matrix.target }}-${{ env.FLUTTER_VERSION }}
- name: Get Version
shell: bash
run: |
if [ "${{ startsWith(github.ref, 'refs/tags/v') }}" = "true" ]; then
echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV
else
echo "VERSION=beta" >> $GITHUB_ENV
fi
- run: echo "VERSION = $VERSION"
shell: bash
- name: Install Linux dependencies
if: matrix.target == 'linux'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libx11-dev pkg-config cmake ninja-build libblkid-dev
sudo apt-get install -y libayatana-appindicator3-dev
- name: Install Android dependencies
if: matrix.target == 'android'
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Enable desktop support
if: matrix.target != 'android'
run: |
flutter config --no-cli-animations
flutter config --enable-linux-desktop
flutter config --enable-macos-desktop
flutter config --enable-windows-desktop
- name: flutter doctor
if: matrix.target != 'windows'
run: flutter doctor -v
- name: Checkout chaldea code
uses: actions/checkout@v4
- name: Configure Keystore for Android
if: matrix.target == 'android'
run: |
echo "$PLAY_STORE_UPLOAD_KEY" | base64 --decode > app/upload-keystore.jks
echo "storeFile=upload-keystore.jks" >> key.properties
echo "keyAlias=$KEYSTORE_KEY_ALIAS" >> key.properties
echo "storePassword=$KEYSTORE_STORE_PASSWORD" >> key.properties
echo "keyPassword=$KEYSTORE_KEY_PASSWORD" >> key.properties
env:
PLAY_STORE_UPLOAD_KEY: ${{ secrets.PLAY_STORE_UPLOAD_KEY }}
KEYSTORE_KEY_ALIAS: ${{ secrets.KEYSTORE_KEY_ALIAS }}
KEYSTORE_KEY_PASSWORD: ${{ secrets.KEYSTORE_KEY_PASSWORD }}
KEYSTORE_STORE_PASSWORD: ${{ secrets.KEYSTORE_STORE_PASSWORD }}
working-directory: android
- name: Enable long path on Windows
if: matrix.target == 'windows'
run: git config --system core.longpaths true
- name: Generate git info
run: dart ./scripts/gen_git_info.dart
- run: flutter pub get
- run: dart ./scripts/patch_before_build.dart ${{ matrix.target }} ${{ github.ref }}
- run: flutter pub get
- run: flutter build ${{ matrix.build_target }} -v --release ${{ matrix.build_options }}
- name: Build AAB
if: matrix.target == 'android'
run: flutter build appbundle -v --release --flavor=play
# Package the build.
- name: Copy VC redistributables to release directory for Windows
if: matrix.target == 'windows'
run: |
Copy-Item (vswhere -latest -find 'VC\Redist\MSVC\*\x64\*\msvcp140.dll') .
Copy-Item (vswhere -latest -find 'VC\Redist\MSVC\*\x64\*\vcruntime140.dll') .
Copy-Item (vswhere -latest -find 'VC\Redist\MSVC\*\x64\*\vcruntime140_1.dll') .
working-directory: ${{ matrix.build_path }}
- name: Rename build for Android
if: matrix.target == 'android'
run: |
mv flutter-apk/app-play-release.apk $GITHUB_WORKSPACE/chaldea-$VERSION-${{ matrix.target }}.apk
mv bundle/playRelease/app-play-release.aab $GITHUB_WORKSPACE/chaldea-$VERSION-appbundle.aab
working-directory: ${{ matrix.build_path }}
- name: Compress build for Linux
if: matrix.target == 'linux'
run: |
cp $GITHUB_WORKSPACE/linux/README.md ./README.txt
mv ../plugins/flutter_js/bundle/lib/libquickjs_c_bridge_plugin.so ./lib/libquickjs_c_bridge_plugin.so
tar czf $GITHUB_WORKSPACE/chaldea-$VERSION-${{ matrix.target }}.tar.gz *
working-directory: ${{ matrix.build_path }}
- name: Compress build for macOS
if: matrix.target == 'macOS'
run: ditto -c -k --sequesterRsrc --keepParent Chaldea.app $GITHUB_WORKSPACE/chaldea-$VERSION-${{ matrix.target }}.zip
working-directory: ${{ matrix.build_path }}
- name: Compress build for Windows
if: matrix.target == 'windows'
run: |
cp ${env:GITHUB_WORKSPACE}/windows/README.md ./README.txt
compress-archive -Path * -DestinationPath ${env:GITHUB_WORKSPACE}\chaldea-${env:VERSION}-${{ matrix.target }}.zip
working-directory: ${{ matrix.build_path }}
- name: Generate Release Note
if: matrix.target == 'android'
run: dart ./scripts/release_note.dart ${{ env.VERSION }} release-note.md
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: chaldea-${{ env.VERSION }}-${{ matrix.target }}
if-no-files-found: error
path: |
./chaldea-${{ env.VERSION }}-*
release-note.md
publish-release:
name: Publish Release
needs: create-build
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
permissions:
contents: write
steps:
- name: Get Date
id: get-date
run: echo "date=$(/bin/date -u +"%Y/%m/%d %H:%M:%S %Z")" >> $GITHUB_OUTPUT
- uses: actions/download-artifact@v4
- name: Move to dist & create checksums
run: |
ls -l -R
mkdir dist
mv chaldea-*/chaldea-* dist/
pushd dist
shasum -a 1 chaldea-*.{apk,aab,zip,gz} >checksums.txt
cat checksums.txt
ls -l
popd
- name: Get Version
shell: bash
run: |
if [ "${{ startsWith(github.ref, 'refs/tags/v') }}" = "true" ]; then
echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV
else
echo "VERSION=beta" >> $GITHUB_ENV
fi
- name: Delete previous beta build
if: github.ref == 'refs/heads/main'
run: gh release delete beta -R ${{ github.repository }} -y --cleanup-tag || echo "delete beta failed"
env:
GH_TOKEN: ${{ secrets.GH_PAGES_TOKEN }}
- name: Publish Beta
id: release-beta
if: github.ref == 'refs/heads/main'
uses: softprops/action-gh-release@v2
with:
name: beta
tag_name: beta
draft: false
prerelease: true
fail_on_unmatched_files: true
body: Built at ${{ steps.get-date.outputs.date }}
body_path: chaldea-${{ env.VERSION }}-android/release-note.md
files: "dist/*"
- name: Publish Stable
id: release-stable
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v2
with:
fail_on_unmatched_files: true
body: Built at ${{ steps.get-date.outputs.date }}
body_path: chaldea-${{ env.VERSION }}-android/release-note.md
files: "dist/*"
- name: Check draft status
env:
GITHUB_TOKEN: ${{ secrets.GH_PAGES_TOKEN }}
RELEASE_ID: ${{ steps.release-beta.outputs.id || steps.release-stable.outputs.id }}
run: |
OWNER="chaldea-center"
REPO="chaldea"
TOKEN=$GITHUB_TOKEN
sleep 15
response=$(curl -Ls -H "Accept: application/vnd.github+json" -H "Authorization: Bearer $TOKEN" -H "X-GitHub-Api-Version: 2022-11-28" "https://api.github.com/repos/$OWNER/$REPO/releases/$RELEASE_ID")
echo "$response"
is_draft=$(echo "$response" | jq '.draft')
if [ "$is_draft" = true ]; then
response2=$(curl -L -X PATCH -H "Authorization: Bearer $TOKEN" --data '{"draft":false}' "https://api.github.com/repos/$OWNER/$REPO/releases/$RELEASE_ID")
echo "Publish draft: $(echo "$response2" | jq '.draft')"
else
echo "Already published"
fi