ci: fix pages ci script #7
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: CI | |
on: | |
push: | |
branches: [main] | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
env: | |
JAVA_VERSION: 17 | |
FLUTTER_VERSION: 3.19.1 | |
jobs: | |
Windows: | |
name: Build Windows | |
runs-on: windows-latest | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v4 | |
- name: Set up Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: ${{ env.FLUTTER_VERSION }} | |
cache: true | |
- name: Build | |
run: ./scripts/build_windows.ps1 | |
- name: Upload Artifact | |
id: upload-windows-artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: windows-release | |
path: ${{ github.workspace }}/release | |
Linux: | |
name: Build Linux | |
runs-on: ubuntu-latest | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v4 | |
- name: Install Tools | |
uses: awalsh128/cache-apt-pkgs-action@latest | |
with: | |
packages: clang cmake git ninja-build pkg-config libgtk-3-dev liblzma-dev libstdc++-12-dev | |
version: 1.0 | |
- name: Set up Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: ${{env.FLUTTER_VERSION}} | |
cache: true | |
- name: Build | |
run: sh ./scripts/build_linux.sh | |
- name: Upload Artifact | |
id: upload-linux-artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: linux-release | |
path: ${{ github.workspace }}/release | |
Android: | |
name: Build Android | |
runs-on: ubuntu-latest | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v4 | |
- name: Set up Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: ${{env.FLUTTER_VERSION}} | |
cache: true | |
- name: Install Tools | |
uses: awalsh128/cache-apt-pkgs-action@latest | |
with: | |
packages: rename | |
version: 1.0 | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
java-version: ${{env.JAVA_VERSION}} | |
distribution: "temurin" | |
cache: "gradle" | |
- name: Cache Gradle | |
uses: actions/cache@v3 | |
with: | |
key: ${{ runner.os }}-gradle-cache | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
- name: Set up SDK | |
uses: android-actions/setup-android@v3 | |
- name: Set up Keystore | |
uses: timheuer/base64-to-file@v1 | |
with: | |
encodedString: ${{secrets.KEY_STORE_FILE}} | |
fileName: keystore.jks | |
fileDir: android/app | |
- name: Set up Environment Variables | |
run: | | |
echo "storeFile=keystore.jks" >> android/key.properties | |
echo "storePassword=${{ secrets.STORE_PASSWORD }}" >> android/key.properties | |
echo "keyAlias=${{ secrets.KEY_ALIAS }}" >> android/key.properties | |
echo "keyPassword=${{ secrets.KEY_PASSWORD }}" >> android/key.properties | |
- name: Build | |
run: sh ./scripts/build_android.sh | |
- name: Upload Artifact | |
id: upload-android-artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: android-release | |
path: ${{ github.workspace }}/release | |
BuildPages: | |
defaults: | |
run: | |
working-directory: ./web | |
name: Build Pages | |
runs-on: ubuntu-latest | |
needs: [Windows, Linux, Android] | |
concurrency: | |
group: pages | |
cancel-in-progress: false | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Add Windows Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: windows-release | |
# working-directory not work | |
path: ./web/public/release | |
- name: Add Linux Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: linux-release | |
# working-directory not work | |
path: ./web/public/release | |
- name: Add Android Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: android-release | |
# working-directory not work | |
path: ./web/public/release | |
- name: Install pnpm | |
uses: pnpm/action-setup@v3 | |
with: | |
version: 8 | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Setup Pages | |
uses: actions/configure-pages@v4 | |
- name: Install dependencies | |
run: pnpm install | |
- name: Build with VitePress | |
run: pnpm run docs:build | |
- name: Upload Pages artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
# working-directory not work | |
path: "./web/dist" | |
DeployPages: | |
name: Deploy Pages | |
runs-on: ubuntu-latest | |
needs: BuildPages | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |