Skip to content

Commit

Permalink
feat: Added payments release flow (#71)
Browse files Browse the repository at this point in the history
* disabled release

* added new release flow

* fix typos
  • Loading branch information
diegolagospagopa authored Oct 17, 2024
1 parent 4c72958 commit ed33af8
Show file tree
Hide file tree
Showing 2 changed files with 111 additions and 72 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/payments-flow-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: payments release

on:
push:
branches:
- develop
- uat
- main
paths-ignore:
- 'CODEOWNERS'
- '**.md'
- '.**'
workflow_dispatch:

jobs:
payments-flow-release:
runs-on: ubuntu-22.04
environment: dev
steps:
- name: 🔖 Checkout code
# https://github.com/actions/checkout/releases/tag/v4.2.1
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871
with:
ref: ${{ github.ref_name }}

- name: 🚀 release + docker + azdo
# https://github.com/pagopa/github-actions-template/releases/tag/v1.16.0
uses: pagopa/github-actions-template/payments-flow-release@payments-release
with:
current_branch: ${{ github.ref_name }}
enable_azure_devops_step: 'true'
azure_devops_project_url: 'https://dev.azure.com/pagopaspa/devopslab-projects'
azure_devops_pipeline_name: 'devopslab-diego-deploy.deploy'
azure_devops_pat: ${{ secrets.AZUREDEVOPS_PAT }}
azure_template_parameters: |
{
"APPS": "[one-color]",
"POSTMAN_BRANCH": "${{ github.ref_name }}"
}
144 changes: 72 additions & 72 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,81 +1,81 @@
name: Release
# name: Release

on:
push:
branches:
- develop
- uat
- main
paths-ignore:
- 'CODEOWNERS'
- '**.md'
- '.**'
# on:
# push:
# branches:
# - develop
# - uat
# - main
# paths-ignore:
# - 'CODEOWNERS'
# - '**.md'
# - '.**'

jobs:
release:
name: Release
runs-on: ubuntu-22.04
# jobs:
# release:
# name: Release
# runs-on: ubuntu-22.04

steps:
- name: Checkout code
uses: actions/checkout@v3
# steps:
# - name: Checkout code
# uses: actions/checkout@v3

- name: Set tag format
id: set-tag-format
run: |
if [[ "${{ github.ref }}" == "refs/heads/develop" ]]; then
echo "TAG_FORMAT=develop-v\${version}" >> $GITHUB_OUTPUT
elif [[ "${{ github.ref }}" == "refs/heads/uat" ]]; then
echo "TAG_FORMAT=uat-v\${version}" >> $GITHUB_OUTPUT
elif [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
echo "TAG_FORMAT=v\${version}" >> $GITHUB_OUTPUT
fi
# - name: Set tag format
# id: set-tag-format
# run: |
# if [[ "${{ github.ref }}" == "refs/heads/develop" ]]; then
# echo "TAG_FORMAT=develop-v\${version}" >> $GITHUB_OUTPUT
# elif [[ "${{ github.ref }}" == "refs/heads/uat" ]]; then
# echo "TAG_FORMAT=uat-v\${version}" >> $GITHUB_OUTPUT
# elif [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
# echo "TAG_FORMAT=v\${version}" >> $GITHUB_OUTPUT
# fi

- name: 🚀 Release
id: release
uses: pagopa/eng-github-actions-iac-template/global/release-action@release-with-
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
tag_format: ${{ steps.set-tag-format.outputs.TAG_FORMAT }}
branches: ${{ github.ref_name }}
# - name: 🚀 Release
# id: release
# uses: pagopa/eng-github-actions-iac-template/global/release-action@release-with-
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# tag_format: ${{ steps.set-tag-format.outputs.TAG_FORMAT }}
# branches: ${{ github.ref_name }}

- name: Log in to the Github Container registry
id: docker_login
if: steps.release.outputs.new_release_published == 'true'
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 #v3.2.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# - name: Log in to the Github Container registry
# id: docker_login
# if: steps.release.outputs.new_release_published == 'true'
# uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 #v3.2.0
# with:
# registry: ghcr.io
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}

- name: Set Docker tags
id: set_docker_tags
if: steps.release.outputs.new_release_published == 'true'
run: |
if [[ "${{ github.ref }}" == "refs/heads/develop" ]]; then
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
elif [[ "${{ github.ref }}" == "refs/heads/uat" ]]; then
echo "DOCKER_TAGS=ghcr.io/${{ github.repository }}:uat-${{ steps.release.outputs.new_release_version }},ghcr.io/${{ github.repository }}:uat-latest" >> $GITHUB_OUTPUT
elif [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
echo "DOCKER_TAGS=ghcr.io/${{ github.repository }}:${{ steps.release.outputs.new_release_version }}" >> $GITHUB_OUTPUT
fi
# - name: Set Docker tags
# id: set_docker_tags
# if: steps.release.outputs.new_release_published == 'true'
# run: |
# if [[ "${{ github.ref }}" == "refs/heads/develop" ]]; then
# 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
# elif [[ "${{ github.ref }}" == "refs/heads/uat" ]]; then
# echo "DOCKER_TAGS=ghcr.io/${{ github.repository }}:uat-${{ steps.release.outputs.new_release_version }},ghcr.io/${{ github.repository }}:uat-latest" >> $GITHUB_OUTPUT
# elif [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
# echo "DOCKER_TAGS=ghcr.io/${{ github.repository }}:${{ steps.release.outputs.new_release_version }}" >> $GITHUB_OUTPUT
# fi

- name: Build and push Docker image with release version
id: docker_build_push
if: steps.release.outputs.new_release_published == 'true'
uses: docker/build-push-action@1a162644f9a7e87d8f4b053101d1d9a712edc18c #v6.3.0
with:
context: .
push: true
tags: ${{ steps.set_docker_tags.outputs.DOCKER_TAGS }}
labels: |
maintainer=https://pagopa.it
org.opencontainers.image.source=https://github.com/${{ github.repository }}
# - name: Build and push Docker image with release version
# id: docker_build_push
# if: steps.release.outputs.new_release_published == 'true'
# uses: docker/build-push-action@1a162644f9a7e87d8f4b053101d1d9a712edc18c #v6.3.0
# with:
# context: .
# push: true
# tags: ${{ steps.set_docker_tags.outputs.DOCKER_TAGS }}
# labels: |
# maintainer=https://pagopa.it
# org.opencontainers.image.source=https://github.com/${{ github.repository }}

# - name: Trigger Azure DevOps pipeline
# if: github.ref == 'refs/heads/develop'
# uses: Azure/pipelines@v1
# with:
# azure-devops-project-url: 'https://dev.azure.com/organization/project-name'
# azure-pipeline-name: 'your-pipeline-name'
# azure-devops-token: ${{ secrets.AZURE_DEVOPS_PAT }}
# # - name: Trigger Azure DevOps pipeline
# # if: github.ref == 'refs/heads/develop'
# # uses: Azure/pipelines@v1
# # with:
# # azure-devops-project-url: 'https://dev.azure.com/organization/project-name'
# # azure-pipeline-name: 'your-pipeline-name'
# # azure-devops-token: ${{ secrets.AZURE_DEVOPS_PAT }}

0 comments on commit ed33af8

Please sign in to comment.