From 85edd887622ad0a1e7a9a96e7a73794202e3d323 Mon Sep 17 00:00:00 2001 From: Max Kalashnikoff Date: Mon, 22 Jan 2024 16:15:22 +0100 Subject: [PATCH] fix(ci): using the `current`, `latest` or `manual` image tag in the manual deploy (#293) * fix(ci): using the latest image tag in the manual deploy * fix(ci): changing to latest, current and manual tags --- .github/workflows/dispatch_deploy.yml | 28 +++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/.github/workflows/dispatch_deploy.yml b/.github/workflows/dispatch_deploy.yml index 7afef9d1..3a435124 100644 --- a/.github/workflows/dispatch_deploy.yml +++ b/.github/workflows/dispatch_deploy.yml @@ -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: @@ -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 @@ -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.1.2 with: @@ -54,13 +63,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 | 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 }}