chore(ci): utilize new build channels

This commit is contained in:
Jagandeep Brar
2022-03-31 14:33:49 -04:00
parent 26cc2585b2
commit ec58cb30b3
11 changed files with 320 additions and 172 deletions

View File

@@ -1,76 +0,0 @@
name: Prepare
on:
workflow_call:
inputs:
ref:
type: string
required: true
outputs:
flavor:
description: "Build Flavor Environment (internal, alpha, beta, production)"
value: ${{ jobs.flavor.outputs.output1 }}
track:
description: "Track Name (Develop, Alpha, Beta, Production)"
value: ${{ jobs.flavor.outputs.output2 }}
jobs:
flavor:
name: Flavor
runs-on: ubuntu-latest
outputs:
output1: ${{ steps.output.outputs.flavor }}
output2: ${{ steps.output.outputs.track }}
steps:
- name: Determine Flavor
id: determine_flavor
uses: actions/github-script@v5
env:
FLAVOR: ${{ inputs.ref }}
with:
result-encoding: string
script: |
const ref = process.env.FLAVOR || 'internal';
switch (ref) {
case "alpha": return "alpha";
case "beta": return "beta";
case "production": return "production";
default: return "internal";
}
- name: Determine Track
id: determine_track
uses: actions/github-script@v5
env:
FLAVOR: ${{ inputs.ref }}
with:
result-encoding: string
script: |
const ref = process.env.FLAVOR || 'internal';
switch (ref) {
case "alpha": return "Alpha";
case "beta": return "Beta";
case "production": return "Production";
default: return "Develop";
}
- name: Set Flavor Output
id: output
run: |
echo "::set-output name=flavor::${{ steps.determine_flavor.outputs.result }}"
echo "::set-output name=track::${{ steps.determine_track.outputs.result }}"
- name: Create Flavor Configuration
working-directory: ${{ github.workspace }}
run: |
echo FLAVOR=${{ steps.determine_flavor.outputs.result }}
echo TRACK=${{ steps.determine_track.outputs.result }}
echo COMMIT=${{ github.sha }}
echo $'FLAVOR=${{ steps.determine_flavor.outputs.result }}\nCOMMIT=${{ github.sha }}' > .flavor
- name: Upload Flavor Configuration
uses: actions/upload-artifact@v2
with:
name: flavor-${{ github.sha }}
path: ${{ github.workspace }}/.flavor

92
.github/workflows/prepare_build.yml vendored Normal file
View File

@@ -0,0 +1,92 @@
name: Prepare Build
on:
workflow_call:
inputs:
ref:
type: string
required: true
outputs:
flavor:
description: "Build Flavor"
value: ${{ jobs.flavor.outputs.output1 }}
number:
description: "Build Number"
value: ${{ jobs.number.outputs.output1 }}
jobs:
flavor:
name: Flavor
runs-on: ubuntu-latest
outputs:
output1: ${{ steps.output.outputs.flavor }}
steps:
- name: Run Script
id: script
uses: actions/github-script@v6
env:
FLAVOR: ${{ inputs.ref }}
with:
result-encoding: string
script: |
const ref = process.env.FLAVOR || "edge";
switch (ref) {
case "beta": return "beta";
case "candidate": return "candidate";
case "stable": return "stable";
default: return "edge";
}
- name: Set Output
id: output
run: |
echo ${{ steps.script.outputs.result }}
echo "::set-output name=flavor::${{ steps.script.outputs.result }}"
- name: Create Flavor Configuration
working-directory: ${{ github.workspace }}
run: |
echo $'FLAVOR=${{ steps.script.outputs.result }}\nCOMMIT=${{ github.sha }}' > .flavor
- name: Upload Flavor Configuration
uses: actions/upload-artifact@v2
with:
name: flavor-${{ github.sha }}
path: ${{ github.workspace }}/.flavor
number:
name: Number
runs-on: ubuntu-latest
outputs:
output1: ${{ steps.output.outputs.number }}
steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Count Commits
id: commit_count
run: |
count=`git rev-list HEAD --count`
echo "::set-output name=commit_count::$count"
- name: Run Script
id: script
uses: actions/github-script@v6
env:
FLAVOR: ${{ inputs.ref }}
COUNT: ${{ steps.commit_count.outputs.commit_count }}
with:
result-encoding: string
script: |
const count = process.env.COUNT || 0;
const base = 1000000000;
return base + count;
- name: Set Output
id: output
run: |
echo ${{ steps.script.outputs.result }}
echo "::set-output name=number::${{ steps.script.outputs.result }}"

139
.github/workflows/prepare_channels.yml vendored Normal file
View File

@@ -0,0 +1,139 @@
name: Prepare Channels
on:
workflow_call:
inputs:
ref:
type: string
required: true
outputs:
android:
description: "Android Deployment Channel"
value: ${{ jobs.android.outputs.output1 }}
ios:
description: "iOS Deployment Channel"
value: ${{ jobs.ios.outputs.output1 }}
linux:
description: "Linux Deployment Channel"
value: ${{ jobs.linux.outputs.output1 }}
macos:
description: "macOS Deployment Channel"
value: ${{ jobs.macos.outputs.output1 }}
jobs:
android:
name: Android
runs-on: ubuntu-latest
outputs:
output1: ${{ steps.output.outputs.channel }}
steps:
- name: Run Script
id: script
uses: actions/github-script@v6
env:
FLAVOR: ${{ inputs.ref }}
with:
result-encoding: string
script: |
const ref = process.env.FLAVOR || "edge";
switch (ref) {
case "beta": return "alpha";
case "candidate": return "beta";
case "stable": return "production";
case "edge":
default: return "internal";
}
- name: Set Output
id: output
run: |
echo ${{ steps.script.outputs.result }}
echo "::set-output name=channel::${{ steps.script.outputs.result }}"
ios:
name: iOS
runs-on: ubuntu-latest
outputs:
output1: ${{ steps.output.outputs.channel }}
steps:
- name: Run Script
id: script
uses: actions/github-script@v6
env:
FLAVOR: ${{ inputs.ref }}
with:
result-encoding: string
script: |
const ref = process.env.FLAVOR || "edge";
switch (ref) {
case "beta": return "beta";
case "candidate": return "candidate";
case "stable": return "stable";
case "edge":
default: return "edge";
}
- name: Set Output
id: output
run: |
echo ${{ steps.script.outputs.result }}
echo "::set-output name=channel::${{ steps.script.outputs.result }}"
linux:
name: Linux
runs-on: ubuntu-latest
outputs:
output1: ${{ steps.output.outputs.channel }}
steps:
- name: Run Script
id: script
uses: actions/github-script@v6
env:
FLAVOR: ${{ inputs.ref }}
with:
result-encoding: string
script: |
const ref = process.env.FLAVOR || "edge";
switch (ref) {
case "beta": return "beta";
case "candidate": return "candidate";
case "stable": return "stable";
case "edge":
default: return "edge";
}
- name: Set Output
id: output
run: |
echo ${{ steps.script.outputs.result }}
echo "::set-output name=channel::${{ steps.script.outputs.result }}"
macos:
name: macOS
runs-on: ubuntu-latest
outputs:
output1: ${{ steps.output.outputs.channel }}
steps:
- name: Run Script
id: script
uses: actions/github-script@v6
env:
FLAVOR: ${{ inputs.ref }}
with:
result-encoding: string
script: |
const ref = process.env.FLAVOR || "edge";
switch (ref) {
case "beta": return "beta";
case "candidate": return "candidate";
case "stable": return "stable";
case "edge":
default: return "edge";
}
- name: Set Output
id: output
run: |
echo ${{ steps.script.outputs.result }}
echo "::set-output name=channel::${{ steps.script.outputs.result }}"

View File

@@ -7,14 +7,15 @@ on:
workflow_dispatch:
inputs:
flavor:
description: Build Flavour
description: Build Flavor
required: true
default: alpha
default: edge
type: choice
options:
- alpha
- edge
- beta
- production
- candidate
- stable
jobs:
cancel:
@@ -26,16 +27,23 @@ jobs:
with:
access_token: ${{ github.token }}
prepare:
name: Prepare
prepare_build:
name: Prepare Build
needs: [ cancel ]
uses: JagandeepBrar/LunaSea/.github/workflows/prepare.yml@master
uses: JagandeepBrar/LunaSea/.github/workflows/prepare_build.yml@master
with:
ref: ${{ github.event.inputs.flavor }}
prepare_channels:
name: Prepare Channels
needs: [ cancel ]
uses: JagandeepBrar/LunaSea/.github/workflows/prepare_channels.yml@master
with:
ref: ${{ github.event.inputs.flavor }}
generate_files:
name: Generate
needs: [ prepare ]
needs: [ prepare_build ]
uses: JagandeepBrar/LunaSea/.github/workflows/generate_files.yml@master
secrets:
FIREBASE_OPTIONS: ${{ secrets.FIREBASE_OPTIONS }}
@@ -49,11 +57,12 @@ jobs:
android:
name: Android
needs: [ prepare, validate ]
needs: [ prepare_build, prepare_channels, validate ]
uses: JagandeepBrar/LunaSea/.github/workflows/release_android.yml@master
with:
flavor: ${{ needs.prepare.outputs.flavor }}
track: ${{ needs.prepare.outputs.track }}
build_flavor: ${{ needs.prepare_build.outputs.build_flavor }}
build_number: ${{ needs.prepare_build.outputs.build_number }}
channel: ${{ needs.prepare_channels.outputs.android }}
secrets:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
FIREBASE_OPTIONS: ${{ secrets.FIREBASE_OPTIONS }}
@@ -63,11 +72,12 @@ jobs:
ios:
name: iOS
needs: [ prepare, validate ]
needs: [ prepare_build, prepare_channels, validate ]
uses: JagandeepBrar/LunaSea/.github/workflows/release_ios.yml@master
with:
flavor: ${{ needs.prepare.outputs.flavor }}
track: ${{ needs.prepare.outputs.track }}
build_flavor: ${{ needs.prepare_build.outputs.build_flavor }}
build_number: ${{ needs.prepare_build.outputs.build_number }}
channel: ${{ needs.prepare_channels.outputs.ios }}
secrets:
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_ITC_TEAM_ID: ${{ secrets.APPLE_ITC_TEAM_ID }}
@@ -85,11 +95,12 @@ jobs:
macos:
name: macOS
needs: [ prepare, validate ]
needs: [ prepare_build, prepare_channels, validate ]
uses: JagandeepBrar/LunaSea/.github/workflows/release_macos.yml@master
with:
flavor: ${{ needs.prepare.outputs.flavor }}
track: ${{ needs.prepare.outputs.track }}
build_flavor: ${{ needs.prepare_build.outputs.build_flavor }}
build_number: ${{ needs.prepare_build.outputs.build_number }}
channel: ${{ needs.prepare_channels.outputs.macos }}
secrets:
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_ITC_TEAM_ID: ${{ secrets.APPLE_ITC_TEAM_ID }}
@@ -107,12 +118,12 @@ jobs:
web:
name: Web
needs: [ prepare, validate ]
if: ${{ needs.prepare.outputs.flavor == 'internal' }}
needs: [ prepare_build, prepare_channels, validate ]
if: ${{ needs.prepare.outputs.build_flavor == 'edge' }}
uses: JagandeepBrar/LunaSea/.github/workflows/release_web.yml@master
with:
flavor: ${{ needs.prepare.outputs.flavor }}
track: ${{ needs.prepare.outputs.track }}
build_flavor: ${{ needs.prepare_build.outputs.build_flavor }}
build_number: ${{ needs.prepare_build.outputs.build_number }}
secrets:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
FIREBASE_OPTIONS: ${{ secrets.FIREBASE_OPTIONS }}

View File

@@ -3,10 +3,13 @@ name: '[Release] Android'
on:
workflow_call:
inputs:
flavor:
build_flavor:
required: true
type: string
track:
build_number:
required: true
type: string
channel:
required: true
type: string
@@ -85,7 +88,7 @@ jobs:
- name: Upload App Bundle Artifact
uses: actions/upload-artifact@v2
with:
name: android-${{ inputs.flavor }}-${{ github.sha }}
name: android-${{ inputs.build_flavor }}-${{ github.sha }}
path: ${{ github.workspace }}/build/app/outputs/bundle/release/app-release.aab
- name: Send Discord Message
@@ -94,8 +97,8 @@ jobs:
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
with:
title: '`[${{ inputs.track }}]` Android Build'
description: android-${{ inputs.flavor }}-${{ github.sha }}
title: '`[${{ inputs.build_flavor }}]` Android Build'
description: android-${{ inputs.build_flavor }}-${{ github.sha }}
deploy:
name: Deploy
@@ -108,7 +111,7 @@ jobs:
- name: Download App Package Artifact
uses: actions/download-artifact@v2
with:
name: android-${{ inputs.flavor }}-${{ github.sha }}
name: android-${{ inputs.build_flavor }}-${{ github.sha }}
path: ${{ github.workspace }}
- name: Install Secret Keys
@@ -127,13 +130,4 @@ jobs:
SUPPLY_JSON_KEY: ${{ github.workspace }}/.fastlane-android-auth.json
run: |
bundle install
bundle exec fastlane deploy track:${{ inputs.flavor }} aab:${{ github.workspace }}/app-release.aab version_name:${{ github.sha }}
- name: Send Discord Message
uses: sarisia/actions-status-discord@v1
if: always()
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
with:
title: '`[${{ inputs.track }}]` Android Deployment'
description: android-${{ inputs.flavor }}-${{ github.sha }}
bundle exec fastlane deploy track:${{ inputs.channel }} aab:${{ github.workspace }}/app-release.aab version_name:${{ github.sha }} build_number:${{ inputs.build_number }}

View File

@@ -3,10 +3,13 @@ name: '[Release] iOS'
on:
workflow_call:
inputs:
flavor:
build_flavor:
required: true
type: string
track:
build_number:
required: true
type: string
channel:
required: true
type: string
@@ -113,7 +116,7 @@ jobs:
- name: Upload App Package Artifact
uses: actions/upload-artifact@v2
with:
name: ios-${{ inputs.flavor }}-${{ github.sha }}
name: ios-${{ inputs.build_flavor }}-${{ github.sha }}
path: ${{ github.workspace }}/ios/Runner.ipa
- name: Send Discord Message
@@ -122,8 +125,8 @@ jobs:
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
with:
title: '`[${{ inputs.track }}]` iOS Build'
description: ios-${{ inputs.flavor }}-${{ github.sha }}
title: '`[${{ inputs.build_flavor }}]` iOS Build'
description: ios-${{ inputs.build_flavor }}-${{ github.sha }}
deploy:
name: Deploy
@@ -136,7 +139,7 @@ jobs:
- name: Download App Package Artifact
uses: actions/download-artifact@v2
with:
name: ios-${{ inputs.flavor }}-${{ github.sha }}
name: ios-${{ inputs.build_flavor }}-${{ github.sha }}
path: ${{ github.workspace }}
- name: Install Secret Keys
@@ -160,13 +163,4 @@ jobs:
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
run: |
bundle install
bundle exec fastlane deploy groups:${{ inputs.flavor }} ipa:${{ github.workspace }}/Runner.ipa
- name: Send Discord Message
uses: sarisia/actions-status-discord@v1
if: always()
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
with:
title: '`[${{ inputs.track }}]` iOS Deployment'
description: ios-${{ inputs.flavor }}-${{ github.sha }}
bundle exec fastlane deploy groups:${{ inputs.channel }} ipa:${{ github.workspace }}/Runner.ipa build_number:${{ inputs.build_number }}

View File

@@ -3,10 +3,13 @@ name: '[Release] macOS'
on:
workflow_call:
inputs:
flavor:
build_flavor:
required: true
type: string
track:
build_number:
required: true
type: string
channel:
required: true
type: string
@@ -114,7 +117,7 @@ jobs:
- name: Upload App Package Artifact
uses: actions/upload-artifact@v2
with:
name: macos-${{ inputs.flavor }}-${{ github.sha }}
name: macos-${{ inputs.build_flavor }}-${{ github.sha }}
path: ${{ github.workspace }}/macos/LunaSea.pkg
- name: Send Discord Message
@@ -123,8 +126,8 @@ jobs:
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
with:
title: '`[${{ inputs.track }}]` macOS Build'
description: macos-${{ inputs.flavor }}-${{ github.sha }}
title: '`[${{ inputs.build_flavor }}]` macOS Build'
description: macos-${{ inputs.build_flavor }}-${{ github.sha }}
deploy:
name: Deploy
@@ -137,7 +140,7 @@ jobs:
- name: Download App Package Artifact
uses: actions/download-artifact@v2
with:
name: macos-${{ inputs.flavor }}-${{ github.sha }}
name: macos-${{ inputs.build_flavor }}-${{ github.sha }}
path: ${{ github.workspace }}
- name: Install Secret Keys
@@ -161,13 +164,4 @@ jobs:
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
run: |
bundle install
bundle exec fastlane deploy groups:${{ inputs.flavor }} pkg:${{ github.workspace }}/LunaSea.pkg
- name: Send Discord Message
uses: sarisia/actions-status-discord@v1
if: always()
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
with:
title: '`[${{ inputs.track }}]` macOS Deployment'
description: macos-${{ inputs.flavor }}-${{ github.sha }}
bundle exec fastlane deploy groups:${{ inputs.channel }} pkg:${{ github.workspace }}/LunaSea.pkg build_number:${{ inputs.build_number }}

View File

@@ -3,10 +3,10 @@ name: '[Release] Web'
on:
workflow_call:
inputs:
flavor:
build_flavor:
required: true
type: string
track:
build_number:
required: true
type: string
@@ -58,12 +58,12 @@ jobs:
- name: Build LunaSea
working-directory: ${{ github.workspace }}
run: |
flutter build web --web-renderer canvaskit --release
flutter build web --web-renderer canvaskit --release --build-number=${{ inputs.build_number }}
- name: Upload Web Build Artifact
uses: actions/upload-artifact@v2
with:
name: web-${{ inputs.flavor }}-${{ github.sha }}
name: web-${{ inputs.build_flavor }}-${{ github.sha }}
path: ${{ github.workspace }}/build/web
- name: Send Discord Message
@@ -72,8 +72,8 @@ jobs:
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
with:
title: '`[${{ inputs.track }}]` Web Build'
description: web-${{ inputs.flavor }}-${{ github.sha }}
title: '`[${{ inputs.build_flavor }}]` Web Build'
description: web-${{ inputs.build_flavor }}-${{ github.sha }}
deploy:
name: Deploy
@@ -86,7 +86,7 @@ jobs:
- name: Download Web Build Artifact
uses: actions/download-artifact@v2
with:
name: web-${{ inputs.flavor }}-${{ github.sha }}
name: web-${{ inputs.build_flavor }}-${{ github.sha }}
path: ${{ github.workspace }}/build/web
- name: Deploy to GitHub Pages
@@ -98,12 +98,3 @@ jobs:
clean: true
clean-exclude: |
CNAME
- name: Send Discord Message
uses: sarisia/actions-status-discord@v1
if: always()
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
with:
title: '`[${{ inputs.track }}]` Web Deployment'
description: web-${{ inputs.flavor }}-${{ github.sha }}