|
| 1 | +name: Build |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v[0-9]+.[0-9]+.[0-9]+' |
| 7 | + workflow_dispatch: |
| 8 | + inputs: |
| 9 | + version: |
| 10 | + description: 'App version string (e.g. 1.2.3)' |
| 11 | + required: true |
| 12 | + default: '0.0.1' |
| 13 | + build_number: |
| 14 | + description: 'Build number (integer)' |
| 15 | + required: true |
| 16 | + default: '1' |
| 17 | + |
| 18 | +jobs: |
| 19 | + |
| 20 | + build-linux: |
| 21 | + runs-on: ubuntu-24.04 |
| 22 | + container: |
| 23 | + image: stackwallet/stackwallet-ci:latest |
| 24 | + credentials: |
| 25 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 26 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 27 | + steps: |
| 28 | + - uses: actions/checkout@v6 |
| 29 | + with: |
| 30 | + fetch-depth: 0 |
| 31 | + submodules: recursive |
| 32 | + |
| 33 | + - name: Set version |
| 34 | + id: ver |
| 35 | + run: | |
| 36 | + if [ "${{ github.ref_type }}" = "tag" ]; then |
| 37 | + VERSION="${{ github.ref_name }}" |
| 38 | + VERSION="${VERSION#v}" |
| 39 | + BUILD_NUMBER="${{ github.run_number }}" |
| 40 | + else |
| 41 | + VERSION="${{ inputs.version }}" |
| 42 | + BUILD_NUMBER="${{ inputs.build_number }}" |
| 43 | + fi |
| 44 | + echo "version=${VERSION}" >> $GITHUB_OUTPUT |
| 45 | + echo "build_number=${BUILD_NUMBER}" >> $GITHUB_OUTPUT |
| 46 | +
|
| 47 | + - name: Configure app |
| 48 | + run: | |
| 49 | + cd scripts |
| 50 | + echo "yes" | ./build_app.sh \ |
| 51 | + -v "${{ steps.ver.outputs.version }}" \ |
| 52 | + -b "${{ steps.ver.outputs.build_number }}" \ |
| 53 | + -p linux -a stack_wallet -d -s |
| 54 | +
|
| 55 | + - name: Get dependencies |
| 56 | + run: flutter pub get |
| 57 | + |
| 58 | + - name: Create git_versions.dart stubs |
| 59 | + run: | |
| 60 | + mkdir -p crypto_plugins/flutter_libepiccash/lib |
| 61 | + mkdir -p crypto_plugins/flutter_libmwc/lib |
| 62 | +
|
| 63 | + EPIC_TAG=$(git -C crypto_plugins/flutter_libepiccash describe --tags --exact-match HEAD 2>/dev/null || echo "dev") |
| 64 | + MWC_TAG=$(git -C crypto_plugins/flutter_libmwc describe --tags --exact-match HEAD 2>/dev/null || echo "dev") |
| 65 | +
|
| 66 | + printf 'String getPluginVersion() => "%s";\n' "$EPIC_TAG" \ |
| 67 | + > crypto_plugins/flutter_libepiccash/lib/git_versions.dart |
| 68 | + printf 'String getPluginVersion() => "%s";\n' "$MWC_TAG" \ |
| 69 | + > crypto_plugins/flutter_libmwc/lib/git_versions.dart |
| 70 | +
|
| 71 | + - name: Decode secrets |
| 72 | + env: |
| 73 | + CHANGE_NOW: ${{ secrets.CHANGE_NOW }} |
| 74 | + run: echo "$CHANGE_NOW" | base64 --decode > lib/external_api_keys.dart |
| 75 | + |
| 76 | + - name: Generate app config |
| 77 | + run: dart run build_runner build --delete-conflicting-outputs |
| 78 | + |
| 79 | + - name: Build |
| 80 | + run: flutter build linux --release |
| 81 | + |
| 82 | + - name: Package |
| 83 | + run: | |
| 84 | + tar -czf "stack_wallet-linux-x86_64-${{ steps.ver.outputs.version }}.tar.gz" \ |
| 85 | + -C build/linux/x64/release bundle |
| 86 | +
|
| 87 | + - uses: actions/upload-artifact@v4 |
| 88 | + with: |
| 89 | + name: stack_wallet-linux-x86_64-${{ steps.ver.outputs.version }} |
| 90 | + path: stack_wallet-linux-x86_64-${{ steps.ver.outputs.version }}.tar.gz |
| 91 | + |
| 92 | + build-android: |
| 93 | + runs-on: ubuntu-24.04 |
| 94 | + container: |
| 95 | + image: stackwallet/stackwallet-ci:latest |
| 96 | + credentials: |
| 97 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 98 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 99 | + steps: |
| 100 | + - uses: actions/checkout@v6 |
| 101 | + with: |
| 102 | + fetch-depth: 0 |
| 103 | + submodules: recursive |
| 104 | + |
| 105 | + - name: Set version |
| 106 | + id: ver |
| 107 | + run: | |
| 108 | + if [ "${{ github.ref_type }}" = "tag" ]; then |
| 109 | + VERSION="${{ github.ref_name }}" |
| 110 | + VERSION="${VERSION#v}" |
| 111 | + BUILD_NUMBER="${{ github.run_number }}" |
| 112 | + else |
| 113 | + VERSION="${{ inputs.version }}" |
| 114 | + BUILD_NUMBER="${{ inputs.build_number }}" |
| 115 | + fi |
| 116 | + echo "version=${VERSION}" >> $GITHUB_OUTPUT |
| 117 | + echo "build_number=${BUILD_NUMBER}" >> $GITHUB_OUTPUT |
| 118 | +
|
| 119 | + - name: Configure app |
| 120 | + run: | |
| 121 | + cd scripts |
| 122 | + echo "yes" | ./build_app.sh \ |
| 123 | + -v "${{ steps.ver.outputs.version }}" \ |
| 124 | + -b "${{ steps.ver.outputs.build_number }}" \ |
| 125 | + -p android -a stack_wallet -d -s |
| 126 | +
|
| 127 | + - name: Get dependencies |
| 128 | + run: flutter pub get |
| 129 | + |
| 130 | + - name: Create git_versions.dart stubs |
| 131 | + run: | |
| 132 | + mkdir -p crypto_plugins/flutter_libepiccash/lib |
| 133 | + mkdir -p crypto_plugins/flutter_libmwc/lib |
| 134 | +
|
| 135 | + EPIC_TAG=$(git -C crypto_plugins/flutter_libepiccash describe --tags --exact-match HEAD 2>/dev/null || echo "dev") |
| 136 | + MWC_TAG=$(git -C crypto_plugins/flutter_libmwc describe --tags --exact-match HEAD 2>/dev/null || echo "dev") |
| 137 | +
|
| 138 | + printf 'String getPluginVersion() => "%s";\n' "$EPIC_TAG" \ |
| 139 | + > crypto_plugins/flutter_libepiccash/lib/git_versions.dart |
| 140 | + printf 'String getPluginVersion() => "%s";\n' "$MWC_TAG" \ |
| 141 | + > crypto_plugins/flutter_libmwc/lib/git_versions.dart |
| 142 | +
|
| 143 | + - name: Decode secrets |
| 144 | + env: |
| 145 | + CHANGE_NOW: ${{ secrets.CHANGE_NOW }} |
| 146 | + run: echo "$CHANGE_NOW" | base64 --decode > lib/external_api_keys.dart |
| 147 | + |
| 148 | + - name: Generate app config |
| 149 | + run: dart run build_runner build --delete-conflicting-outputs |
| 150 | + |
| 151 | + - name: Set up Android local.properties |
| 152 | + run: | |
| 153 | + cat > android/local.properties <<EOF |
| 154 | + sdk.dir=${ANDROID_SDK_ROOT} |
| 155 | + flutter.sdk=${FLUTTER_HOME} |
| 156 | + EOF |
| 157 | +
|
| 158 | + - name: Set up signing |
| 159 | + env: |
| 160 | + KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }} |
| 161 | + run: | |
| 162 | + echo "$KEYSTORE_BASE64" | base64 --decode > android/keystore.jks |
| 163 | + cat > android/key.properties <<EOF |
| 164 | + storeFile=../keystore.jks |
| 165 | + storePassword=${{ secrets.ANDROID_STORE_PASSWORD }} |
| 166 | + keyPassword=${{ secrets.ANDROID_KEY_PASSWORD }} |
| 167 | + keyAlias=${{ secrets.ANDROID_KEY_ALIAS }} |
| 168 | + EOF |
| 169 | +
|
| 170 | + - name: Build APKs |
| 171 | + run: flutter build apk --split-per-abi --release |
| 172 | + |
| 173 | + - name: Build AAB |
| 174 | + run: flutter build appbundle --release |
| 175 | + |
| 176 | + - name: Collect artifacts |
| 177 | + run: | |
| 178 | + VERSION="${{ steps.ver.outputs.version }}" |
| 179 | + mkdir -p android-artifacts |
| 180 | + cp build/app/outputs/flutter-apk/app-arm64-v8a-release.apk \ |
| 181 | + android-artifacts/stack_wallet-android-arm64-v8a-${VERSION}.apk |
| 182 | + cp build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk \ |
| 183 | + android-artifacts/stack_wallet-android-armeabi-v7a-${VERSION}.apk |
| 184 | + cp build/app/outputs/flutter-apk/app-x86_64-release.apk \ |
| 185 | + android-artifacts/stack_wallet-android-x86_64-${VERSION}.apk |
| 186 | + cp build/app/outputs/bundle/release/app-release.aab \ |
| 187 | + android-artifacts/stack_wallet-android-${VERSION}.aab |
| 188 | +
|
| 189 | + - uses: actions/upload-artifact@v4 |
| 190 | + with: |
| 191 | + name: stack_wallet-android-${{ steps.ver.outputs.version }} |
| 192 | + path: android-artifacts/ |
| 193 | + |
| 194 | + release: |
| 195 | + if: github.ref_type == 'tag' |
| 196 | + needs: [build-linux, build-android] |
| 197 | + runs-on: ubuntu-latest |
| 198 | + permissions: |
| 199 | + contents: write |
| 200 | + steps: |
| 201 | + - uses: actions/download-artifact@v4 |
| 202 | + with: |
| 203 | + path: artifacts |
| 204 | + merge-multiple: true |
| 205 | + |
| 206 | + - uses: softprops/action-gh-release@v2 |
| 207 | + with: |
| 208 | + generate_release_notes: true |
| 209 | + files: artifacts/* |
0 commit comments