diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml index 292723f..e084a5c 100644 --- a/.github/workflows/tag.yml +++ b/.github/workflows/tag.yml @@ -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 @@ -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/amazon-ecr-login@v1.6.1 - - - 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 }}