Skip to content

[266] fix: pub cache #49

[266] fix: pub cache

[266] fix: pub cache #49

Workflow file for this run

name: Release
on:
push:
branches:
- main
- 266_fdroid_build
permissions:
contents: write
jobs:
get_version:
name: Get the app version
environment: release
runs-on: ubuntu-latest
outputs:
version: ${{ steps.echo_version.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get version
id: get_version
uses: mikefarah/yq@master
with:
cmd: yq -r '.version' 'pubspec.yaml' | cut -d '+' -f 1
- name: Echo version
id: echo_version
run: echo "version=${{ steps.get_version.outputs.result }}" >> "$GITHUB_OUTPUT"
release_play_store:
name: Release on the Play Store
environment: release
needs: [ get_version ]
runs-on: ubuntu-latest
if: false
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'
flutter-version-file: pubspec.yaml
- name: Add keystore
run: echo "${{ secrets.ANDROID_KEYSTORE }}" | base64 -d > android/localmaterialnotes_keystore.jks
- name: Add key properties
run: echo "${{ secrets.ANDROID_KEY_PROPERTIES }}" > android/key.properties
- name: Add fastlane supply key
run: echo "${{ secrets.FASTLANE_SUPPLY_KEY }}" | base64 -d > fastlane/localmaterialnotes_fastlane-supply_key.json
- name: Generate files
run: |
dart run build_runner build
flutter gen-l10n
- name: Run fastlane
run: bundle exec fastlane deploy_production
release_github:
name: Release on GitHub
environment: release
needs: [ get_version ] # TODO change back
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: 'true'
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'
flutter-version-file: pubspec.yaml
- name: Get dependencies
run: |
mkdir .pub-cache
export PUB_CACHE=.pub-cache
flutter pub get
- name: Setup Isar
run: |
sudo apt install -y tofrodos
fromdos .isar/tool/build_android.sh
bash scripts/isar/fdroid_build_isar.sh
- name: Add keystore
run: echo "${{ secrets.ANDROID_KEYSTORE }}" | base64 -d > android/localmaterialnotes_keystore.jks
- name: Add key properties
run: echo "${{ secrets.ANDROID_KEY_PROPERTIES }}" > android/key.properties
- name: Generate code
run: |
dart run build_runner build
flutter gen-l10n
- name: Build app (fat APK)
run: flutter build apk --release
- name: Build app (per ABIs)
run: flutter build apk --release --split-per-abi
- name: Move and rename APKs
run: |
mkdir release
mv build/app/outputs/flutter-apk/app-release.apk release/localmaterialnotes_v${{ needs.get_version.outputs.version }}.apk
mv build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk release/localmaterialnotes_armeabi-v7a_v${{ needs.get_version.outputs.version }}.apk
mv build/app/outputs/flutter-apk/app-arm64-v8a-release.apk release/localmaterialnotes_arm64-v8a_v${{ needs.get_version.outputs.version }}.apk
mv build/app/outputs/flutter-apk/app-x86_64-release.apk release/localmaterialnotes_x86_64_v${{ needs.get_version.outputs.version }}.apk
- name: Archive APK
uses: actions/upload-artifact@v4
with:
name: LocalMaterialNotes
path: build/app/outputs/flutter-apk/localmaterialnotes_arm64-v8a_v1.8.2.apk
- name: Extract changelog
id: extract_changelog
uses: dahlia/submark@main
with:
input-file: CHANGELOG.md
heading-level: 2
heading-title-regex: ^${{ needs.get_version.outputs.version }}
omit-heading: true
- name: Create release tag
uses: actions/github-script@v7.0.1
with:
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/v${{ needs.get_version.outputs.version }}',
sha: context.sha
})
- name: Publish to GitHub releases
uses: softprops/action-gh-release@v2
with:
make_latest: true
name: v${{ needs.get_version.outputs.version }}
body: ${{ steps.extract_changelog.outputs.output-text }}
tag_name: v${{ needs.get_version.outputs.version }}
files: release/*