Skip to content

Commit

Permalink
add release job
Browse files Browse the repository at this point in the history
  • Loading branch information
Codel1417 committed Apr 4, 2024
1 parent 2b08bc5 commit 070a110
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 16 deletions.
60 changes: 49 additions & 11 deletions .github/workflows/build_apk.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
on:
push:
pull_request:

release:
types: [ created ]
jobs:
build_android:
name: Build Android Artifact
runs-on: ubuntu-latest
outputs:
SENTRY_RELEASE: ${{ steps.build.outputs.SENTRY_RELEASE }}
SENTRY_DIST: ${{ steps.build.outputs.SENTRY_DIST }}

steps:
- uses: actions/checkout@v4
with:
Expand All @@ -19,27 +24,60 @@ jobs:
flutter-version: '3.19.2'
cache: true
- name: Run build script
id: build
run: bash ${GITHUB_WORKSPACE}/Scripts/build.sh
working-directory: Scripts
- uses: actions/upload-artifact@v4
with:
path: |
build/app/outputs/apk
build/app/outputs/bundle
compression-level: 0 # bundles are already compressed
- name: Upload debug symbols
run: flutter packages pub run sentry_dart_plugin
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
SENTRY_URL: ${{ secrets.SENTRY_URL }}
# - name: Create Sentry release
# uses: getsentry/action-release@v1
# env:
# SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
# SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
# SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
# SENTRY_URL: ${{ secrets.SENTRY_URL }}
# with:
# version: ${{ steps.read_action_js.outputs['version'] }}
SENTRY_DIST: ${{ needs.build_android.outputs.SENTRY_DIST }}
SENTRY_RELEASE: ${{ needs.build_android.outputs.SENTRY_RELEASE }}
release-job:
name: Releasing
needs: build_android
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'created'
steps:
- uses: actions/download-artifact@v4
with:
name: Android.zip
- name: Upload release attachment
uses: actions/github-script@v4
with:
script: |
const fs = require('fs');
const tag = context.ref.replace("refs/tags/", "");
// Get release for this tag
const release = await github.repos.getReleaseByTag({
owner: context.repo.owner,
repo: context.repo.repo,
tag
});
// Upload the release asset
await github.repos.uploadReleaseAsset({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: release.data.id,
name: "Android.zip",
data: await fs.readFileSync("Android.zip")
});
- name: Create Sentry release
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
SENTRY_URL: ${{ secrets.SENTRY_URL }}
SENTRY_DIST: ${{ needs.build_android.outputs.SENTRY_DIST }}
SENTRY_RELEASE: ${{ needs.build_android.outputs.SENTRY_RELEASE }}
with:
version: ${{ steps.read_action_js.outputs['version'] }}
14 changes: 9 additions & 5 deletions Scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@ set -x
if [[ "$(pwd)" == *"/Scripts" ]]; then
cd ..
fi
VERSION="$(cat VERSION)"
BUILD_NUMBER="$(git rev-list HEAD --count)"
flutter config --no-cli-animations
flutter pub get
flutter gen-l10n
dart run intl_translation:generate_from_arb --output-dir=lib/l10n --no-use-deferred-loading lib/Frontend/intnDefs.dart lib/l10n/*.arb
flutter pub run build_runner build --delete-conflicting-outputs
flutter build apk --split-per-abi --split-debug-info=./symbols --build-number="$(git rev-list HEAD --count)"
flutter build appbundle --split-debug-info=./symbols --build-number="$(git rev-list HEAD --count)"
if [[ -v GITHUB_ENV ]]; then
echo "SENTRY_DIST=$(git rev-list HEAD --count)" >> "$GITHUB_ENV"
fi
flutter build apk --split-per-abi --split-debug-info=./symbols --build-number="$BUILD_NUMBER" --build-name="$VERSION"
flutter build appbundle --split-debug-info=./symbols --build-number="$BUILD_NUMBER" --build-name="$VERSION"
if [[ -v GITHUB_OUTPUT ]]; then
echo "SENTRY_DIST=$BUILD_NUMBER" >> "$GITHUB_OUTPUT"
echo "SENTRY_RELEASE=VERSION" >> "$GITHUB_OUTPUT"
fi
echo
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.0.0

0 comments on commit 070a110

Please sign in to comment.