fix: tokens #37
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: Build and distribute | |
on: | |
push: | |
branches: | |
- pre_main_qa | |
jobs: | |
build: | |
name: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code with submodules | |
uses: actions/checkout@v4 | |
with: | |
submodules: 'recursive' | |
- name: Count closed PRs | |
id: pr_count | |
run: | | |
PR_COUNT=$(gh api graphql -f query=' | |
query($owner:String!, $repo:String!) { | |
repository(owner:$owner, name:$repo) { | |
pullRequests(states:CLOSED) { | |
totalCount | |
} | |
} | |
}' -f owner="${{ github.repository_owner }}" -f repo="${{ github.event.repository.name }}" --jq '.data.repository.pullRequests.totalCount') | |
echo "PR count is: $PR_COUNT" | |
echo "COUNT=$PR_COUNT" >> $GITHUB_OUTPUT | |
env: | |
GITHUB_TOKEN: ${{ secrets.DART_TOKEN }} | |
- name: Set Version Code | |
run: | | |
echo "Received PR count: ${{ steps.pr_count.outputs.COUNT }}" | |
echo "VERSION_CODE=${{ steps.pr_count.outputs.COUNT }}" >> $GITHUB_ENV | |
echo "Set VERSION_CODE to: ${{ steps.pr_count.outputs.COUNT }}" | |
shell: bash | |
- name: Debug Output | |
run: | | |
echo "VERSION_CODE: ${{ env.VERSION_CODE }}" | |
shell: bash | |
- uses: sheenhx/action-flutter-build-android@v3 | |
with: | |
keystore-base64: ${{ secrets.ANDROID_RELEASE_KEY }} | |
keystore-password: "${{ secrets.ANDROID_RELEASE_KEY_PASSWORD }}" | |
build-cmd: flutter build apk --flavor product --release --build-number=${{ env.VERSION_CODE }} | |
working-directory: ./ | |
- name: Archive APK | |
uses: actions/upload-artifact@v2 | |
with: | |
name: release-apk | |
# Try running the build locally with the build command to be sure of this path | |
path: build/app/outputs/flutter-apk/app-product-release.apk | |
- name: Create GitHub Release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.DART_TOKEN }} | |
with: | |
tag_name: v${{ env.VERSION_CODE }} | |
release_name: Release ${{ env.VERSION_CODE }} | |
draft: false | |
prerelease: false | |
- name: Upload Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.DART_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: build/app/outputs/flutter-apk/app-product-release.apk | |
asset_name: app-product-release.apk | |
asset_content_type: application/vnd.android.package-archive |