|
| 1 | +name: Payments release |
| 2 | +description: Payments release |
| 3 | + |
| 4 | +inputs: |
| 5 | + current_branch: |
| 6 | + required: true |
| 7 | + docker_labels: |
| 8 | + required: false |
| 9 | + default: | |
| 10 | + maintainer=https://pagopa.it |
| 11 | + org.opencontainers.image.source=https://github.com/${{ github.repository }} |
| 12 | + enable_azure_devops_step: |
| 13 | + required: false |
| 14 | + default: false |
| 15 | + azure_devops_project_url: |
| 16 | + required: false |
| 17 | + azure_devops_pipeline_name: |
| 18 | + required: false |
| 19 | + azure_devops_pat: |
| 20 | + required: false |
| 21 | + azure_template_parameters: |
| 22 | + required: false |
| 23 | + |
| 24 | +runs: |
| 25 | + using: "composite" |
| 26 | + steps: |
| 27 | + - name: 🔨 Set release tag format |
| 28 | + id: set-tag-format |
| 29 | + shell: bash |
| 30 | + run: | |
| 31 | + if [[ "${{ github.ref }}" == "refs/heads/develop" ]]; then |
| 32 | + echo "TAG_FORMAT=develop-v\${version}" >> $GITHUB_OUTPUT |
| 33 | + elif [[ "${{ github.ref }}" == "refs/heads/uat" ]]; then |
| 34 | + echo "TAG_FORMAT=uat-v\${version}" >> $GITHUB_OUTPUT |
| 35 | + elif [[ "${{ github.ref }}" == "refs/heads/main" ]]; then |
| 36 | + echo "TAG_FORMAT=v\${version}" >> $GITHUB_OUTPUT |
| 37 | + fi |
| 38 | +
|
| 39 | + - name: 🚀 Release |
| 40 | + id: release |
| 41 | + uses: pagopa/eng-github-actions-iac-template/global/release-action@main |
| 42 | + with: |
| 43 | + github_token: ${{ github.token }} |
| 44 | + tag_format: ${{ steps.set-tag-format.outputs.TAG_FORMAT }} |
| 45 | + branches: ${{ github.ref_name }} |
| 46 | + |
| 47 | +# |
| 48 | +# Docker |
| 49 | +# |
| 50 | + - name: 🔨 Set Docker tags |
| 51 | + id: set_docker_tags |
| 52 | + if: steps.release.outputs.new_release_published == 'true' |
| 53 | + shell: bash |
| 54 | + run: | |
| 55 | + if [[ "${{ github.ref }}" == "refs/heads/develop" ]]; then |
| 56 | + echo "DOCKER_TAGS=ghcr.io/${{ github.repository }}:develop-${{ steps.release.outputs.new_release_version }},ghcr.io/${{ github.repository }}:develop-latest,ghcr.io/${{ github.repository }}:latest" >> $GITHUB_OUTPUT |
| 57 | + elif [[ "${{ github.ref }}" == "refs/heads/uat" ]]; then |
| 58 | + echo "DOCKER_TAGS=ghcr.io/${{ github.repository }}:uat-${{ steps.release.outputs.new_release_version }},ghcr.io/${{ github.repository }}:uat-latest" >> $GITHUB_OUTPUT |
| 59 | + elif [[ "${{ github.ref }}" == "refs/heads/main" ]]; then |
| 60 | + echo "DOCKER_TAGS=ghcr.io/${{ github.repository }}:${{ steps.release.outputs.new_release_version }}" >> $GITHUB_OUTPUT |
| 61 | + fi |
| 62 | +
|
| 63 | + - name: 🛃 Log in to the Github Container registry |
| 64 | + id: docker_login |
| 65 | + if: steps.release.outputs.new_release_published == 'true' |
| 66 | + uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 #v3.2.0 |
| 67 | + with: |
| 68 | + registry: ghcr.io |
| 69 | + username: ${{ github.actor }} |
| 70 | + password: ${{ github.token }} |
| 71 | + |
| 72 | + - name: 📦 Build and push Docker image with release version |
| 73 | + id: docker_build_push |
| 74 | + if: steps.release.outputs.new_release_published == 'true' |
| 75 | + uses: docker/build-push-action@1a162644f9a7e87d8f4b053101d1d9a712edc18c #v6.3.0 |
| 76 | + with: |
| 77 | + context: . |
| 78 | + push: true |
| 79 | + tags: ${{ steps.set_docker_tags.outputs.DOCKER_TAGS }} |
| 80 | + labels: ${{ inputs.docker_labels }} |
| 81 | + |
| 82 | +# |
| 83 | +# AZDO |
| 84 | +# |
| 85 | + - name: 🚂 Trigger Azure DevOps pipeline |
| 86 | + if: inputs.enable_azure_devops_step == 'true' && steps.release.outputs.new_release_published == 'true' |
| 87 | + uses: jacopocarlini/azure-pipelines@v1.3 |
| 88 | + with: |
| 89 | + azure-devops-project-url: ${{ inputs.azure_devops_project_url }} |
| 90 | + azure-pipeline-name: ${{ inputs.azure_devops_pipeline_name }} |
| 91 | + azure-devops-token: ${{ inputs.azure_devops_pat }} |
| 92 | + azure-pipeline-variables: '{"system.debug": "true"}' |
| 93 | + azure-template-parameters: ${{ inputs.azure_template_parameters }} |
0 commit comments