ci: improve artifacts management #40
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: Release | |
on: | |
push: | |
jobs: | |
build: | |
name: Build | |
runs-on: macos-latest | |
steps: | |
- name: Get repository | |
uses: actions/checkout@v4 | |
- name: Configure enviroment | |
env: | |
ENV_PROD_BASE64: ${{ secrets.ENV_PROD_BASE64 }} | |
ENV_DEV_BASE64: ${{ secrets.ENV_DEV_BASE64 }} | |
run: | | |
echo $ENV_PROD_BASE64 | base64 -d > .env/prod.json | |
echo $ENV_DEV_BASE64 | base64 -d > .env/dev.json | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: '18' | |
cache: 'gradle' | |
- name: Setup Flutter | |
uses: kuhnroyal/flutter-fvm-config-action/setup@v3 | |
with: | |
path: '.fvmrc' | |
- name: Install dependencies | |
run: sh tool/setup.sh | |
- name: Get Android keystore secrets | |
env: | |
PLAY_STORE_UPLOAD_KEY: ${{ secrets.PLAY_STORE_UPLOAD_KEY }} | |
PLAY_STORE_UPLOAD_KEY_PROPERTIES: ${{ secrets.PLAY_STORE_UPLOAD_KEY_PROPERTIES }} | |
run: | | |
echo $PLAY_STORE_UPLOAD_KEY | base64 -d > android/key.jks | |
echo $PLAY_STORE_UPLOAD_KEY_PROPERTIES | base64 -d > android/key.properties | |
- name: Build Android apk prod | |
run: sh tool/build-android.sh prod apk | |
- name: Build Android prod | |
run: sh tool/build-android.sh prod appbundle | |
- name: Archive Android artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: android-app | |
path: | | |
build/app/outputs/bundle/prodRelease/app-prod-release.aab | |
build/app/outputs/flutter-apk/app-prod-release.apk | |
retention-days: 1 | |
- name: Build Web prod | |
run: sh tool/build-web.sh prod | |
- name: Archive web artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: web-app | |
path: build/web/ | |
retention-days: 1 | |
upload-play-store: | |
if: ${{ github.ref_type == 'tag' }} | |
name: Upload appbundle | |
runs-on: macos-latest | |
needs: build | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: android-app | |
path: artifacts/ | |
- name: Upload Android Release to Play Store | |
uses: r0adkll/upload-google-play@v1 | |
with: | |
serviceAccountJsonPlainText: ${{ secrets.GOOGLE_PLAY_API_KEY }} | |
packageName: deandrea.matias.tv_randshow | |
releaseFiles: artifacts/app-prod-release.aab | |
track: internal | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: artifacts/app-prod-release.apk | |
deployment-web-preview: | |
if: ${{ github.ref == 'refs/heads/main' }} | |
needs: build | |
name: Deploy web | |
runs-on: ubuntu-latest | |
steps: | |
- name: Configure enviroment | |
uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: web-app | |
path: build/web | |
- name: HTML/CSS/JS Minifier | |
uses: docker://devatherock/minify-js:3.1.0 | |
with: | |
directory: 'build/web' | |
add_suffix: false | |
- uses: FirebaseExtended/action-hosting-deploy@v0 | |
with: | |
repoToken: '${{ secrets.GITHUB_TOKEN }}' | |
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_TV_RANDSHOW }}' | |
projectId: tv-randshow | |
channelId: preview | |
deployment-web: | |
if: ${{ github.ref_type == 'tag' }} | |
needs: build | |
name: Deploy web | |
runs-on: ubuntu-latest | |
steps: | |
- name: Configure enviroment | |
uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: web-app | |
path: build/web | |
- name: HTML/CSS/JS Minifier | |
uses: docker://devatherock/minify-js:3.1.0 | |
with: | |
directory: 'build/web' | |
add_suffix: false | |
- uses: FirebaseExtended/action-hosting-deploy@v0 | |
with: | |
repoToken: '${{ secrets.GITHUB_TOKEN }}' | |
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_TV_RANDSHOW }}' | |
projectId: tv-randshow | |
channelId: live | |
- name: Release | |
uses: softprops/action-gh-release@v2 |