Deploy: 1cc595d24aa892fef31de420f5906babe6e55cb4 ➠ latest: ❱❱ infra #24
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ⚙️ Deploy | |
run-name: "Deploy: ${{ github.sha }} ➠ ${{ inputs.version-type }}:${{ inputs.version-tag }}${{ (!inputs.deploy-infra && !inputs.deploy-app) && ' 👀 deploy nothing' || ''}}${{ inputs.deploy-infra && ' ❱❱ infra' || '' }}${{ inputs.deploy-app && ' ❱❱ app' || '' }}" | |
on: | |
workflow_dispatch: | |
inputs: | |
deploy-infra: | |
description: "Deploy Infra" | |
default: true | |
required: true | |
type: boolean | |
deploy-app: | |
description: "Deploy App" | |
default: true | |
required: true | |
type: boolean | |
stage: | |
description: 'Target Environment' | |
type: choice | |
options: | |
- staging | |
- prod | |
default: staging | |
required: true | |
version-type: | |
description: "Release Version" | |
type: choice | |
options: | |
- latest | |
- manual | |
default: 'latest' | |
required: true | |
version-tag: | |
description: "Release Version Tag (for manual version)" | |
type: string | |
default: '' | |
concurrency: deploy | |
permissions: | |
contents: read | |
id-token: write | |
packages: write | |
jobs: | |
select_version: | |
name: Select Version | |
if: ${{ always() && !cancelled() && !failure() }} | |
runs-on: | |
group: ${{ vars.RUN_GROUP }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 15 | |
fetch-tags: true | |
- name: Select target version | |
id: select_version | |
run: | | |
if [ "${{ inputs.version-type }}" == "latest" ]; then | |
echo "version=$(git tag | sort --version-sort | tail -n1)" >> "$GITHUB_OUTPUT" | |
else | |
echo "version=${{ inputs.version-tag }}" >> "$GITHUB_OUTPUT" | |
fi | |
outputs: | |
version: ${{ steps.select_version.outputs.version }} | |
cd: | |
name: CD | |
needs: [ select_version ] | |
uses: ./.github/workflows/sub-cd.yml | |
secrets: inherit | |
with: | |
deploy-infra: ${{ inputs.deploy-infra }} | |
deploy-app: ${{ inputs.deploy-app }} | |
deploy-prod: ${{ inputs.stage == 'prod' }} | |
version: ${{ needs.select_version.outputs.version }} | |
skip_window: true |