From d866dff53dcb91337d242774239515dfdbf4cbf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Sieczkowski?= Date: Wed, 13 Oct 2021 14:27:42 +0200 Subject: [PATCH] Update release CI (#389) * Don't tag image as `stable` if the version is a release candidate (rc) * Stop deploying commander on new release * Change release CI display name --- .github/workflows/release.yml | 60 ++++++----------------------------- 1 file changed, 10 insertions(+), 50 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f9ef89697..c2b6500d3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -name: E2E Test +name: Release on: release: types: [created] @@ -16,10 +16,15 @@ jobs: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.DOCKER_PASSWORD }} - - name: Set tag name - id: tag_name + - name: Evaluate image tags + id: evaluate-tags run: | - echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/} + VERSION_TAG=${GITHUB_REF#refs/tags/} + if [[ $VERSION_TAG == *"rc"* ]]; then + echo ::set-output name=IMAGE_TAGS::ghcr.io/worldcoin/hubble-commander:${VERSION_TAG} + else + echo ::set-output name=IMAGE_TAGS::ghcr.io/worldcoin/hubble-commander:${VERSION_TAG},ghcr.io/worldcoin/hubble-commander:stable + fi - name: Build docker image id: docker_build uses: docker/build-push-action@v2 @@ -27,49 +32,4 @@ jobs: context: . file: ./Dockerfile push: true - tags: ghcr.io/worldcoin/hubble-commander:${{ steps.tag_name.outputs.SOURCE_TAG }},ghcr.io/worldcoin/hubble-commander:stable - - deploy-backend-api-staging: - runs-on: ubuntu-20.04 - needs: [build] - steps: - - name: Configure AWS EKS credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.STAGING_BACKEND_API_AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.STAGING_BACKEND_API_AWS_SECRET_ACCESS_KEY }} - aws-region: us-east-1 - - name: Download kubeconfig - run: | - aws eks --region us-east-1 update-kubeconfig --name new-staging --kubeconfig $GITHUB_WORKSPACE/kubeconfig - - name: Install kubectl - run: | - curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl - chmod +x ./kubectl - - name: Set tag name - id: tag_name - run: | - echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/} - - name: Update deployment in the cluster - run: | - ./kubectl --kubeconfig ./kubeconfig --namespace=staging set image deployments/hubble-commander primary-hubble-commander=ghcr.io/worldcoin/hubble-commander:${{ steps.tag_name.outputs.SOURCE_TAG }} secondary-hubble-commander=ghcr.io/worldcoin/hubble-commander:${{ steps.tag_name.outputs.SOURCE_TAG }} - - deploy: - name: Deploy to AWS - needs: build - runs-on: ubuntu-20.04 - strategy: - matrix: - host: [ec2-3-238-223-141.compute-1.amazonaws.com, ec2-3-239-149-30.compute-1.amazonaws.com] - steps: - - name: Deploy to AWS - uses: appleboy/ssh-action@master - with: - host: ${{ matrix.host }} - username: ec2-user - key: ${{ secrets.AWS_SSH_KEY }} - script_stop: true - script: | - docker-compose pull - docker-compose up -d - docker images -f "before=ghcr.io/worldcoin/hubble-commander:stable" -f "dangling=true" -q ghcr.io/worldcoin/hubble-commander | xargs docker image rm || true + tags: ${{ steps.evaluate-tags.outputs.IMAGE_TAGS }}