add workflow
This commit is contained in:
84
.gitea/workflows/release.yaml
Normal file
84
.gitea/workflows/release.yaml
Normal file
@@ -0,0 +1,84 @@
|
||||
name: Release Build
|
||||
run-name: Build and Release by ${{ gitea.actor }}
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build-docker:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Build and Push Server
|
||||
run: |
|
||||
cd zen_kanji_js/server
|
||||
docker build -t ${{ vars.REGISTRY }}/zen-kanji-server:latest .
|
||||
docker push ${{ vars.REGISTRY }}/zen-kanji-server:latest
|
||||
|
||||
- name: Build and Push Client
|
||||
run: |
|
||||
cd zen_kanji_js/client
|
||||
docker build -t ${{ vars.REGISTRY }}/zen-kanji-client:latest .
|
||||
docker push ${{ vars.REGISTRY }}/zen-kanji-client:latest
|
||||
|
||||
build-android-and-release:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build-docker
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "20"
|
||||
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: "17"
|
||||
distribution: "temurin"
|
||||
|
||||
- name: Install and Build Web App
|
||||
working-directory: zen_kanji_js/client
|
||||
env:
|
||||
VITE_API_URL: ${{ vars.VITE_API_URL }}
|
||||
run: |
|
||||
npm ci
|
||||
npm run build:android
|
||||
|
||||
- name: Sync Capacitor to Android
|
||||
working-directory: zen_kanji_js/client
|
||||
run: npx cap sync android
|
||||
|
||||
- name: Decode Keystore
|
||||
run: |
|
||||
cd zen_kanji_js/client/android/app
|
||||
echo "${{ secrets.ANDROID_KEYSTORE_BASE64 }}" | base64 -d > my-release-key.jks
|
||||
|
||||
- name: Build Release APK
|
||||
working-directory: zen_kanji_js/client/android
|
||||
env:
|
||||
RELEASE_KEY_PASSWORD: ${{ secrets.RELEASE_KEY_PASSWORD }}
|
||||
RELEASE_KEY_ALIAS: ${{ secrets.RELEASE_KEY_ALIAS }}
|
||||
run: |
|
||||
chmod +x gradlew
|
||||
./gradlew assembleRelease
|
||||
|
||||
- name: Create Release
|
||||
uses: https://gitea.com/actions/release-action@v1
|
||||
with:
|
||||
tag_name: v1.0.${{ gitea.run_number }}
|
||||
name: Release v1.0.${{ gitea.run_number }}
|
||||
body: |
|
||||
Automated release for commit ${{ gitea.sha }}.
|
||||
|
||||
**Docker Images:**
|
||||
- Server: `${{ vars.REGISTRY }}/${{ vars.SERVER_IMAGE }}:latest`
|
||||
- Client: `${{ vars.REGISTRY }}/${{ vars.CLIENT_IMAGE }}:latest`
|
||||
files: |
|
||||
zen_kanji_js/client/android/app/build/outputs/apk/release/*.apk
|
||||
api_key: ${{ secrets.GITHUB_TOKEN }}
|
||||
Reference in New Issue
Block a user