chore(ci): correctly calculate build number

This commit is contained in:
Jagandeep Brar
2022-03-31 16:16:48 -04:00
parent a9ef0d84c6
commit 128f32c95a
7 changed files with 78 additions and 204 deletions

View File

@@ -81,9 +81,9 @@ jobs:
with:
result-encoding: string
script: |
const count = process.env.COUNT || 0;
const count = process.env.COUNT || "0";
const base = 1000000000;
return base + count;
return base + Number(count);
- name: Set Output
id: output

View File

@@ -1,171 +0,0 @@
name: Prepare Channels
on:
workflow_call:
inputs:
ref:
type: string
required: true
outputs:
android:
description: "Android Deployment Channel (Track)"
value: ${{ jobs.android.outputs.output1 }}
ios:
description: "iOS Deployment Channel (Group)"
value: ${{ jobs.ios.outputs.output1 }}
linux:
description: "Linux Deployment Channel (Channel)"
value: ${{ jobs.linux.outputs.output1 }}
macos:
description: "macOS Deployment Channel (Group)"
value: ${{ jobs.macos.outputs.output1 }}
web:
description: "Web Deployment Channel (Site ID)"
value: ${{ jobs.web.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 }}"
web:
name: Web
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 "11ef2676-fc31-41b5-897b-fd21273d87ed";
case "candidate": return "4636e6a1-17ef-45a2-a2b6-3d1c166fd1df";
case "stable": return "6634f0b1-323c-4a2f-bd0b-8f1f388673a9";
case "edge":
default: return "325e197e-55f4-449a-b2bb-6831fe47bf2a";
}
- name: Set Output
id: output
run: |
echo ${{ steps.script.outputs.result }}
echo "::set-output name=channel::${{ steps.script.outputs.result }}"

View File

@@ -34,13 +34,6 @@ jobs:
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_build ]
@@ -57,12 +50,11 @@ jobs:
android:
name: Android
needs: [ prepare_build, prepare_channels, validate ]
needs: [ prepare_build, validate ]
uses: JagandeepBrar/LunaSea/.github/workflows/release_android.yml@master
with:
build_flavor: ${{ needs.prepare_build.outputs.flavor }}
build_number: ${{ needs.prepare_build.outputs.number }}
channel: ${{ needs.prepare_channels.outputs.android }}
secrets:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
FIREBASE_OPTIONS: ${{ secrets.FIREBASE_OPTIONS }}
@@ -72,12 +64,11 @@ jobs:
ios:
name: iOS
needs: [ prepare_build, prepare_channels, validate ]
needs: [ prepare_build, validate ]
uses: JagandeepBrar/LunaSea/.github/workflows/release_ios.yml@master
with:
build_flavor: ${{ needs.prepare_build.outputs.flavor }}
build_number: ${{ needs.prepare_build.outputs.number }}
channel: ${{ needs.prepare_channels.outputs.ios }}
secrets:
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_ITC_TEAM_ID: ${{ secrets.APPLE_ITC_TEAM_ID }}
@@ -95,12 +86,11 @@ jobs:
macos:
name: macOS
needs: [ prepare_build, prepare_channels, validate ]
needs: [ prepare_build, validate ]
uses: JagandeepBrar/LunaSea/.github/workflows/release_macos.yml@master
with:
build_flavor: ${{ needs.prepare_build.outputs.flavor }}
build_number: ${{ needs.prepare_build.outputs.number }}
channel: ${{ needs.prepare_channels.outputs.macos }}
secrets:
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_ITC_TEAM_ID: ${{ secrets.APPLE_ITC_TEAM_ID }}
@@ -118,12 +108,11 @@ jobs:
web:
name: Web
needs: [ prepare_build, prepare_channels, validate ]
needs: [ prepare_build, validate ]
uses: JagandeepBrar/LunaSea/.github/workflows/release_web.yml@master
with:
build_flavor: ${{ needs.prepare_build.outputs.flavor }}
build_number: ${{ needs.prepare_build.outputs.number }}
channel: ${{ needs.prepare_channels.outputs.web }}
secrets:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
FIREBASE_OPTIONS: ${{ secrets.FIREBASE_OPTIONS }}

View File

@@ -9,9 +9,6 @@ on:
build_number:
required: true
type: string
channel:
required: true
type: string
secrets:
DISCORD_WEBHOOK:
@@ -107,6 +104,23 @@ jobs:
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Determine Release Channel
id: channel
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: Download App Package Artifact
uses: actions/download-artifact@v2
@@ -130,4 +144,4 @@ jobs:
SUPPLY_JSON_KEY: ${{ github.workspace }}/.fastlane-android-auth.json
run: |
bundle install
bundle exec fastlane deploy track:${{ inputs.channel }} aab:${{ github.workspace }}/app-release.aab version_name:${{ github.sha }}
bundle exec fastlane deploy track:${{ steps.channel.outputs.result }} aab:${{ github.workspace }}/app-release.aab version_name:${{ github.sha }}

View File

@@ -9,9 +9,6 @@ on:
build_number:
required: true
type: string
channel:
required: true
type: string
secrets:
APPLE_ID:
@@ -136,6 +133,23 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Determine Release Channel
id: channel
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: Download App Package Artifact
uses: actions/download-artifact@v2
with:
@@ -163,4 +177,4 @@ jobs:
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
run: |
bundle install
bundle exec fastlane deploy groups:${{ inputs.channel }} ipa:${{ github.workspace }}/Runner.ipa
bundle exec fastlane deploy groups:${{ steps.channel.outputs.result }} ipa:${{ github.workspace }}/Runner.ipa

View File

@@ -9,9 +9,6 @@ on:
build_number:
required: true
type: string
channel:
required: true
type: string
secrets:
APPLE_ID:
@@ -137,6 +134,23 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Determine Release Channel
id: channel
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: Download App Package Artifact
uses: actions/download-artifact@v2
with:
@@ -164,4 +178,4 @@ jobs:
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
run: |
bundle install
bundle exec fastlane deploy groups:${{ inputs.channel }} pkg:${{ github.workspace }}/LunaSea.pkg
bundle exec fastlane deploy groups:${{ steps.channel.outputs.result }} pkg:${{ github.workspace }}/LunaSea.pkg

View File

@@ -9,9 +9,6 @@ on:
build_number:
required: true
type: string
channel:
required: true
type: string
secrets:
DISCORD_WEBHOOK:
@@ -88,6 +85,23 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Determine Release Channel
id: channel
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 "11ef2676-fc31-41b5-897b-fd21273d87ed";
case "candidate": return "4636e6a1-17ef-45a2-a2b6-3d1c166fd1df";
case "stable": return "6634f0b1-323c-4a2f-bd0b-8f1f388673a9";
case "edge":
default: return "325e197e-55f4-449a-b2bb-6831fe47bf2a";
}
- name: Download Web Build Artifact
uses: actions/download-artifact@v2
with:
@@ -98,7 +112,7 @@ jobs:
uses: nwtgck/actions-netlify@v1.2
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ inputs.channel }}
NETLIFY_SITE_ID: ${{ steps.channel.outputs.result }}
with:
publish-dir: ${{ github.workspace}}/build/web
deploy-message: ${{ github.sha }}