From 42e5dab7c6142dc34a4d432136420b55332a6116 Mon Sep 17 00:00:00 2001 From: Gao Sun Date: Sun, 23 Apr 2023 17:47:28 +0800 Subject: [PATCH] ci: update release workflow (#3742) use the target deployment environment `dev` and `prod` to tag current deployed images instead of `sha-*` since it is unstable and unclear. remove `sha-*` tagged and untagged images regularly. --- .github/workflows/clean-up-images.yml | 2 +- .github/workflows/release.yml | 10 +++------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/clean-up-images.yml b/.github/workflows/clean-up-images.yml index 641111171..3e3bd8a5a 100644 --- a/.github/workflows/clean-up-images.yml +++ b/.github/workflows/clean-up-images.yml @@ -17,5 +17,5 @@ jobs: account-type: org org-name: logto-io keep-at-least: 1 - untagged-only: true + filter-tags: "sha-*" token: ${{ secrets.BOT_PAT }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ee55cb7f5..28138e9a9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -47,7 +47,7 @@ jobs: type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} type=semver,pattern={{major}} - type=sha + type=raw,value=${{ inputs.target || 'dev' }},enable=${{ !startsWith(github.ref, 'refs/tags/') }} type=edge - name: Login to DockerHub @@ -111,7 +111,7 @@ jobs: ghcr.io/logto-io/cloud # https://github.com/docker/metadata-action tags: | - type=sha + type=raw,value=${{ inputs.target || 'dev' }},enable=${{ !startsWith(github.ref, 'refs/tags/') }} type=edge - name: Login to GitHub Container Registry @@ -153,10 +153,6 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Set short sha - id: sha - run: echo "short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT - - name: Setup Node and pnpm if: ${{ (inputs.target || 'dev') == 'dev' && matrix.target == 'core' }} uses: silverhand-io/actions-node-pnpm-run-steps@v3 @@ -186,7 +182,7 @@ jobs: with: app-name: ${{ vars.APP_NAME }} slot-name: staging - images: ghcr.io/logto-io/${{ matrix.image }}:sha-${{ steps.sha.outputs.short }} + images: ghcr.io/logto-io/${{ matrix.image }}:${{ (inputs.target || 'dev') }} swap-staging-prod: strategy: