Skip to content

Commit

Permalink
Pull semvering into separate workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
katybaulch committed Mar 4, 2024
1 parent 7bd2d48 commit a5c44e2
Showing 1 changed file with 14 additions and 44 deletions.
58 changes: 14 additions & 44 deletions .github/workflows/tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,15 @@ on:
repo-name:
required: true
type: string
tag:
required: true
type: string

secrets:
AWS_ACCESS_KEY_ID:
required: true
AWS_SECRET_ACCESS_KEY:
required: true
DOCKER_REGISTRY:
required: true

Expand Down Expand Up @@ -77,51 +82,16 @@ jobs:
echo "New tag: ${new_tag}"
echo "new_tag=${new_tag}" >> "$GITHUB_OUTPUT"
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
- name: Semver tag
uses: ./.github/workflows/semver.yml@main
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/[email protected]

- name: Docker pull, retag and push
env:
NEW_TAG: ${{ steps.determine_next_tag.outputs.new_tag }}
DOCKER_REGISTRY: ${{ secrets.DOCKER_REGISTRY }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: |
docker pull ${DOCKER_REGISTRY}/${{ inputs.repo-name }}:main-${GITHUB_SHA::8}
docker tag ${DOCKER_REGISTRY}/${{ inputs.repo-name }}:main-${GITHUB_SHA::8} ${{ inputs.repo-name }}:main-${GITHUB_SHA::8}
.github/retag-and-push.sh ${{ inputs.repo-name }} main-${GITHUB_SHA::8}
repo-name: ${{ inputs.repo-name }}
tag: ${{ inputs.tag }}

semver-for-manually-created-tags:
if: ${{ startsWith(github.ref, 'refs/tags/') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- 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@v2

- name: Docker pull, retag and push
env:
DOCKER_REGISTRY: ${{ secrets.DOCKER_REGISTRY }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: |
docker pull ${DOCKER_REGISTRY}/${{ inputs.repo-name }}:main-${GITHUB_SHA::8}
docker tag ${DOCKER_REGISTRY}/${{ inputs.repo-name }}:main-${GITHUB_SHA::8} ${{ inputs.repo-name }}:main-${GITHUB_SHA::8}
.github/retag-and-push.sh ${{ inputs.repo-name }} main-${GITHUB_SHA::8}
uses: climatepolicyradar/reusable-workflows/.github/workflows/semver.yml@main
secrets: inherit
with:
repo-name: ${{ inputs.repo-name }}
tag: ${{ inputs.tag }}

0 comments on commit a5c44e2

Please sign in to comment.