From 4a6162e58f19f77c30a04ecc4c79dc22f9933961 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Quentin=20Guid=C3=A9e?= Date: Mon, 4 Mar 2024 14:08:08 -0500 Subject: [PATCH] ci(client): refactor release workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Quentin Guidée --- .github/workflows/client-release.yml | 47 ------------------- .../workflows/{client-dev.yml => client.yml} | 26 ++++++++++ 2 files changed, 26 insertions(+), 47 deletions(-) delete mode 100644 .github/workflows/client-release.yml rename .github/workflows/{client-dev.yml => client.yml} (62%) diff --git a/.github/workflows/client-release.yml b/.github/workflows/client-release.yml deleted file mode 100644 index a0d7097a..00000000 --- a/.github/workflows/client-release.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: Client (release) - -on: - push: - tags: - - "*" - -permissions: - contents: write - -jobs: - release: - name: Release - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Fetch tags - run: git fetch --force --tags - - - name: Setup Node.js - uses: actions/setup-node@v3 - with: - node-version: 16 - - - name: Enable corepack - run: corepack enable - - - name: Install dependencies - run: yarn install --frozen-lockfile - - - name: Build - run: yarn workspace @vertex-center/client build - - - name: Add version file - run: echo ${{ github.ref_name }} > ./client/dist/version.txt - - - name: Create .zip - run: zip client.zip ./client/dist -r - - - name: Publish - uses: softprops/action-gh-release@v1 - with: - files: client.zip diff --git a/.github/workflows/client-dev.yml b/.github/workflows/client.yml similarity index 62% rename from .github/workflows/client-dev.yml rename to .github/workflows/client.yml index abb7b293..517902aa 100644 --- a/.github/workflows/client-dev.yml +++ b/.github/workflows/client.yml @@ -8,6 +8,9 @@ on: - "client/**" - "packages/**" - ".github/workflows/client-dev.yml" + tags: + - "v*" + pull_request: branches: - main @@ -53,3 +56,26 @@ jobs: tags: ${{ steps.meta.outputs.tags }} platforms: linux/amd64,linux/arm64,linux/arm no-cache: true + + promote-docker: + name: Promote Docker images + runs-on: ubuntu-latest + needs: + - build + if: startsWith(github.ref, 'refs/tags/v') + permissions: + contents: read + packages: write + steps: + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Promote images + run: | + docker pull ghcr.io/${{ github.repository_owner }}/client:${{ format('{0}', github.ref_name) }} + docker tag ghcr.io/${{ github.repository_owner }}/client:${{ format('{0}', github.ref_name) }} ghcr.io/${{ github.repository_owner }}/client:latest + docker push ghcr.io/${{ github.repository_owner }}/client:latest