chore: prepare release #36
Workflow file for this run
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: Automated Release | |
on: | |
push: | |
tags: | |
- '[0-9]*.[0-9]*.[0-9]*' | |
env: | |
FLUTTER_VERSION: 3.19.2 | |
DOCKER_NAME: plant-it-server | |
jobs: | |
build_and_test_backend: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup Maven Action | |
uses: s4u/[email protected] | |
with: | |
java-version: 20 | |
- name: Create JAR File | |
run: mvn package | |
working-directory: ./backend | |
- name: Save JAR File | |
uses: actions/upload-artifact@v4 | |
with: | |
name: backend-jar | |
retention-days: 1 | |
path: ./backend/target/*.jar | |
build_and_test_frontend: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: stable | |
flutter-version: ${{ env.FLUTTER_VERSION }} | |
- name: Download Flutter Dependencies | |
run: flutter pub get | |
working-directory: ./frontend | |
- name: Flutter Analyze | |
run: flutter analyze | |
working-directory: ./frontend | |
- name: Flutter Tests | |
run: flutter test | |
working-directory: ./frontend | |
- name: Create Flutter Build Files | |
run: flutter build web --release; | |
working-directory: ./frontend | |
- name: Save Flutter Build Files | |
uses: actions/upload-artifact@v4 | |
with: | |
name: frontend-build | |
retention-days: 1 | |
path: ./frontend/build | |
create_and_push_images: | |
needs: [build_and_test_backend, build_and_test_frontend] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Load JAR File | |
uses: actions/download-artifact@v4 | |
with: | |
name: backend-jar | |
path: ./backend/target/app.jar | |
- name: Load Flutter Build Files | |
uses: actions/download-artifact@v4 | |
with: | |
name: frontend-build | |
path: ./frontend/build | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ vars.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
platforms: linux/amd64,linux/arm64 | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./deployment/Dockerfile | |
push: true | |
platforms: linux/amd64,linux/arm64 | |
tags: | | |
${{ vars.DOCKERHUB_USERNAME }}/${{ env.DOCKER_NAME }}:${{ github.ref_name }} | |
${{ vars.DOCKERHUB_USERNAME }}/${{ env.DOCKER_NAME }}:latest | |
create_apk: | |
needs: build_and_test_frontend | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Download apk-signer tool | |
run: sudo apt-get update -y && sudo apt-get install -y apksigner | |
- name: Debug path info 1 | |
run: pwd | |
- name: Setup Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: stable | |
flutter-version: ${{ env.FLUTTER_VERSION }} | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: '17' | |
- name: Debug path info 2 | |
run: pwd | |
- name: Create apk File | |
run: flutter pub get && flutter build apk --release | |
working-directory: ./frontend | |
- name: Decode keystore | |
run: echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 --decode > keystore.jks | |
working-directory: ./frontend | |
- name: Sign apk File | |
run: | | |
echo ${{ secrets.KEYSTORE_PASSWORD }} | \ | |
apksigner sign --ks-key-alias ${{ secrets.KEYSTORE_KEY_ALIAS }} \ | |
--ks keystore.jks build/app/outputs/flutter-apk/app-release.apk | |
working-directory: ./frontend | |
- name: Verify the APK | |
run: apksigner verify --print-certs --verbose build/app/outputs/flutter-apk/app-release.apk | |
working-directory: ./frontend | |
- name: Save apk File | |
uses: actions/upload-artifact@v4 | |
with: | |
name: frontend-apk | |
retention-days: 1 | |
path: ./frontend/build/app/outputs/flutter-apk/app-release.apk | |
create_release: | |
runs-on: ubuntu-latest | |
needs: create_apk | |
steps: | |
- name: Load apk File | |
uses: actions/download-artifact@v4 | |
with: | |
name: frontend-apk | |
path: . | |
- name: Create Draft Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
draft: true | |
name: v${{ github.ref_name }} | |
body: | | |
Hello, Plant-it community! | |
# Services version | |
- server version: `a.b.c` | |
- app version: `d.e.f` | |
# Highlights | |
# What's Changed | |
## 📱 App | |
- | |
## 🗄️ Server | |
- | |
## 📓 Documentation | |
- | |
# New Contributors | |
* X made their first contribution in Y | |
# Full Changelog | |
https://github.com/MDeLuise/plant-it/compare/ | |
generate_release_notes: true | |
append_body: true | |
files: app-release.apk | |
fail_on_unmatched_files: true | |
token: ${{ secrets.GITHUB_TOKEN }} |