From 183936f28ee9aa8277ef4efe39f821130812ee35 Mon Sep 17 00:00:00 2001 From: Katy Baulch <46493669+katybaulch@users.noreply.github.com> Date: Wed, 6 Mar 2024 17:43:44 +0000 Subject: [PATCH] Complete ci cd workflow using custom composite actions & reusable workflows (#95) --- .github/workflows/{ci.yml => ci-cd.yml} | 13 +++++++++- .github/workflows/debug.yml | 22 ---------------- .github/workflows/semver.yml | 34 ------------------------- 3 files changed, 12 insertions(+), 57 deletions(-) rename .github/workflows/{ci.yml => ci-cd.yml} (92%) delete mode 100644 .github/workflows/debug.yml delete mode 100644 .github/workflows/semver.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci-cd.yml similarity index 92% rename from .github/workflows/ci.yml rename to .github/workflows/ci-cd.yml index 77e424a0..9f050c63 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci-cd.yml @@ -1,4 +1,4 @@ -name: CI +name: CI/CD on: push: @@ -105,6 +105,17 @@ jobs: fi fi + manual-semver: + needs: + - code-quality + - test + if: ${{ startsWith(github.ref, 'refs/tags') }} + uses: climatepolicyradar/reusable-workflows/.github/workflows/semver.yml@main + secrets: inherit + with: + repo-name: navigator-admin-backend + semver-tag: main-${GITHUB_SHA::8} + tag: needs: build uses: climatepolicyradar/reusable-workflows/.github/workflows/tag.yml@main diff --git a/.github/workflows/debug.yml b/.github/workflows/debug.yml deleted file mode 100644 index be0c0092..00000000 --- a/.github/workflows/debug.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: Debug - -on: - workflow_dispatch - -# https://github.com/marketplace/actions/docker-layer-caching -jobs: - tag: - uses: climatepolicyradar/reusable-workflows/.github/workflows/tag.yml@main - with: - repo-name: navigator-admin-backend - semver-tag: main-${GITHUB_SHA::8} - secrets: - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - DOCKER_REGISTRY: ${{ secrets.DOCKER_REGISTRY }} - - release: - needs: tag - uses: climatepolicyradar/reusable-workflows/.github/workflows/release.yml@main - with: - new_tag: ${{ needs.tag.outputs.new_tag }} diff --git a/.github/workflows/semver.yml b/.github/workflows/semver.yml deleted file mode 100644 index 62be14dc..00000000 --- a/.github/workflows/semver.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Semver Tagging - -on: - push: - tags: - - v* - -env: - DOCKER_REGISTRY: ${{ secrets.DOCKER_REGISTRY }} - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - -jobs: - tag-main-with-semver: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v4 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: eu-west-1 - - - name: Login to Amazon ECR - id: login-ecr - uses: aws-actions/amazon-ecr-login@v1.6.1 - - - name: Docker pull, retag and push - run: | - docker pull ${DOCKER_REGISTRY}/navigator-admin-frontend:main-${GITHUB_SHA::8} - docker tag ${DOCKER_REGISTRY}/navigator-admin-frontend:main-${GITHUB_SHA::8} navigator-admin-frontend:main-${GITHUB_SHA::8} - .github/retag-and-push.sh navigator-admin-frontend main-${GITHUB_SHA::8}