mirror of
https://github.com/jagandeepbrar/lunasea.git
synced 2026-08-31 12:42:34 +00:00
77 lines
2.3 KiB
YAML
77 lines
2.3 KiB
YAML
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
|