Skip to content

Commit

Permalink
fix(cd): fixing the current version deployment (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
geekbrother committed Feb 12, 2024
1 parent f988189 commit a336d3e
Showing 1 changed file with 23 additions and 7 deletions.
30 changes: 23 additions & 7 deletions .github/workflows/dispatch_deploy.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: βš™οΈ Deploy
run-name: "Deploy: ${{ github.sha }} ➠ ${{ inputs.version }}${{ (!inputs.deploy-infra && !inputs.deploy-app) && ' πŸ‘€ deploy nothing' || ''}}${{ inputs.deploy-infra && ' ❱❱  infra' || '' }}${{ inputs.deploy-app && ' ❱❱  app' || '' }}"
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:
Expand All @@ -22,10 +22,19 @@ on:
- prod
default: staging
required: true
version:
version-type:
description: "Release Version"
type: choice
options:
- latest
- current
- manual
default: 'latest'
required: true
version-tag:
description: "Release Version Tag (for manual version)"
type: string
default: '-current-'
default: ''

concurrency: deploy

Expand All @@ -38,7 +47,7 @@ permissions:
jobs:
get_deployed_version:
name: Lookup Version
if: ${{ !inputs.deploy-app && inputs.version == '-current-' }}
if: ${{ inputs.version-type == 'current' }}
secrets: inherit
uses: WalletConnect/ci_workflows/.github/workflows/release-get_deployed_version.yml@0.2.4
with:
Expand All @@ -55,13 +64,20 @@ jobs:
runs-on:
group: ${{ vars.RUN_GROUP }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Select target version
id: select_version
run: |
if [ "${{ inputs.deploy-app }}" != "true" ] && [ "${{ inputs.version }}" == "-current-" ]; then
if [ "${{ inputs.version-type }}" == "current" ]; then
echo "version=${{ needs.get_deployed_version.outputs.version }}" >> "$GITHUB_OUTPUT"
elif [ "${{ inputs.version-type }}" == "latest" ]; then
echo "version=$(git tag | grep -v '^v' | sort --version-sort | tail -n1)" >> "$GITHUB_OUTPUT"
else
echo "version=${{ inputs.version }}" >> "$GITHUB_OUTPUT"
echo "version=${{ inputs.version-tag }}" >> "$GITHUB_OUTPUT"
fi
outputs:
version: ${{ steps.select_version.outputs.version }}
Expand All @@ -76,4 +92,4 @@ jobs:
deploy-infra: ${{ inputs.deploy-infra }}
deploy-app: ${{ inputs.deploy-app }}
deploy-prod: ${{ inputs.stage == 'prod' }}
version: ${{ needs.select_version .outputs.version }}
version: ${{ needs.select_version.outputs.version }}

0 comments on commit a336d3e

Please sign in to comment.