Skip to content

Commit

Permalink
ci(Actions): Share data between jobs
Browse files Browse the repository at this point in the history
Use artifact actions to share outputted files between jobs as artifacts

Signed-off-by: arafaysaleem <a.rafaysaleem@gmail.com>
  • Loading branch information
arafaysaleem committed Jun 8, 2021
1 parent 9766ba4 commit c407a67
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/PR-merge-build-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,37 @@ jobs:
echo "storePassword=$KEYSTORE_PASSPHRASE" > ./android/key.properties
echo "keyPassword=$KEYSTORE_PASSPHRASE" > ./android/key.properties
echo "keyAlias=$KEY_ALIAS" > ./android/key.properties
- name: Upload Keystore Artifact
uses: actions/upload-artifact@v2.2.3
with:
name: signing-key-artifact
path: './android/$KEYSTORE_FILENAME'
if-no-files-found: error
retention-days: 1
- name: Upload Key Properties Artifact
uses: actions/upload-artifact@v2.2.3
with:
name: signing-key-artifact
path: ./android/key.properties
if-no-files-found: error
retention-days: 1

build-release:
needs: [flutter-setup,assemble-release]
name: Build Release APKS
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Download Keystore Artifact
uses: actions/download-artifact@v2.0.9
with:
name: signing-key-artifact #Must be same as upload artifact in previous job
path: './android/${{ secrets.KEYSTORE_FILENAME }}'
- name: Download Key Properties Artifact
uses: actions/download-artifact@v2.0.9
with:
name: signing-key-artifact #Must be same as upload artifact in previous job
path: ./android/key.properties
- uses: actions/setup-java@v1
with:
java-version: '12.x'
Expand All @@ -69,6 +93,13 @@ jobs:
run: flutter packages pub run build_runner build --delete-conflicting-outputs
- name: Generate splitted release apks
run: flutter build apk --target-platform android-arm,android-arm64 --split-per-abi --obfuscate --split-debug-info=./ez_tickets_app/debug_trace
- name: Upload Key Properties Artifact
uses: actions/upload-artifact@v2.2.3
with:
name: built-apks-artifact
path: 'build/app/outputs/flutter-apk/*.apk'
if-no-files-found: error
retention-days: 1

release-artifacts-upload:
needs: [build-release]
Expand All @@ -82,6 +113,11 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }}
default_bump: minor # major, minor, patch, false
custom_release_rules: "ci:patch:CI/CD,chore:patch:Chore Tasks,hotfix:minor:Bug Fixes,refact:patch:Refactors,docs:patch:Documentation Changes,build:patch:Build System/Dependency Upgrades"
- name: Download Built APKs Artifact
uses: actions/download-artifact@v2.0.9
with:
name: built-apks-artifact #Must be same as upload artifact in previous job
path: 'build/app/outputs/flutter-apk/*.apk'
- name: Upload release apk to artifacts
uses: ncipollo/release-action@v1.8.6
with:
Expand All @@ -96,6 +132,11 @@ jobs:
name: Upload APKS to google drive
runs-on: ubuntu-latest
steps:
- name: Download Built APKs Artifact
uses: actions/download-artifact@v2.0.9
with:
name: built-apks-artifact #Must be same as upload artifact in previous job
path: 'build/app/outputs/flutter-apk/*.apk'
- name: Upload apks to google drive
uses: mkrakowitzer/actions-googledrive@1
with:
Expand All @@ -105,3 +146,15 @@ jobs:
google-client-id: ${{ secrets.DRIVE_CLIENT_ID }}
google-client-secret: ${{ secrets.DRIVE_CLIENT_SECRET }}
remove-outdated: 'false'

cleanup_job:
needs: [ google-drive-upload, release-artifacts-upload ]
runs-on: ubuntu-latest
steps:
- name: Delete All Artifacts
uses: GeekyEggo/delete-artifact@v1.0.0
with:
name: |
signing-key-artifact
built-apks-artifact
failOnError: false

0 comments on commit c407a67

Please sign in to comment.