add github workflow release #12
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
# This is a basic workflow to help you get started with Actions | |
name: Clipious release | |
# Controls when the workflow will run | |
on: | |
push: | |
branches: | |
- 'master' | |
# Pattern matched against refs/tags | |
tags: | |
- '**' | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
env: | |
ANDROID_KEY_FILE: /tmp/key.properties | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "build" | |
build: | |
name: flutter release | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
#env: | |
# JAVA_VERSION: "11.0" | |
# FLUTTER_VERSION: "2.5.3" | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: cachix/install-nix-action@v22 | |
with: | |
nix_path: nixpkgs=channel:nixos-23.11 | |
- name: Create keystore.jks | |
run: | | |
echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 -d > /tmp/keystore.jks | |
md5sum /tmp/keystore.jks | |
- name: Create key.properties | |
run: | | |
echo "storeFile=/tmp/keystore.jks" > ${ANDROID_KEY_FILE} | |
echo "storePassword=${{ secrets.STORE_PASSWORD }}" >> ${ANDROID_KEY_FILE} | |
echo "keyPassword=${{ secrets.KEY_PASSWORD }}" >> ${ANDROID_KEY_FILE} | |
echo "keyAlias=${{ secrets.KEY_ALIAS }}" >> ${ANDROID_KEY_FILE} | |
md5sum /tmp/key.properties | |
- run: git submodule init | |
- run: git submodule update | |
- run: set -e | |
- run: cp -R ./ /tmp/build | |
- name: Build app | |
working-directory: /tmp/build | |
run: | | |
git submodule init | |
git submodule update | |
export PUB_CACHE=$(pwd)/.pub-cache | |
./submodules/flutter/bin/flutter doctor | |
./submodules/flutter/bin/flutter config --no-analytics | |
./submodules/flutter/bin/flutter pub get | |
./submodules/flutter/bin/flutter pub run flutter_native_splash:create | |
./submodules/flutter/bin/flutter build apk --split-per-abi | |
./submodules/flutter/bin/flutter build apk | |
./submodules/flutter/bin/flutter build appbundle | |
- name: Moving build artifacts | |
run: | | |
mkdir -p build/app/outputs/flutter-apk | |
mkdir -p build/app/outputs/bundle/release | |
cp /tmp/build/build/app/outputs/flutter-apk/* build/app/outputs/flutter-apk/ | |
cp /tmp/build/build/app/outputs/bundle/release/* build/app/outputs/bundle/release/ | |
- name: Create apks file for accrescent | |
run: nix-shell nix/bundletool.nix --run 'bundletool build-apks --bundle=build/app/outputs/bundle/release/app-release.aab --output=build/app/outputs/bundle/release/app-release.apks --ks-pass=pass:${{ secrets.STORE_PASSWORD }} --ks=/tmp/keystore.jks --ks-key-alias=upload --key-pass=pass:${{ secrets.KEY_PASSWORD }} --aapt2=$(which aapt2)' | |
- run: ls build/app/outputs/flutter-apk/ | |
- run: ls build/app/outputs/bundle/release/ | |
# - name: Upload binaries to release | |
# uses: svenstaro/upload-release-action@v2 | |
# with: | |
# repo_token: ${{ secrets.GITHUB_TOKEN }} | |
# file: target/release/my* | |
# tag: ${{ github.ref }} | |
# overwrite: true | |
# file_glob: true |