[GITOPS] - Merging 'release' in 'main' - Releasing into Production #29
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Automatically, Publish a Production Tag | |
# RUNS when a PR 'release' --> 'main/master' Merges AND PR has label 'auto-deploy' | |
# - if PR was closed without a merge of code it does NOT run | |
on: | |
pull_request: | |
types: [closed] | |
branches: | |
# access with ${{ github.event.pull_request.base.ref }} | |
- main | |
- master | |
jobs: | |
# The cicd-test Suite references the test branch | |
# So, we push it to have the same state as, before the RC Tag Push | |
# which tag triggers CI Tests | |
put_test_branch_to_main: | |
uses: ./.github/workflows/_update_test_branch.yml | |
if: github.event.pull_request.merged == true && | |
github.event.pull_request.head.ref == 'release' && | |
contains(github.event.pull_request.labels.*.name, 'auto-deploy') | |
with: | |
target_branch: ${{ github.event.pull_request.base.ref }} | |
secrets: | |
# needs Contents write to push to test branch | |
GH_TOKEN_CONTENTS_RW: ${{ secrets.GA_WORKFLOWS_CI_PR_RW_AND_ACTIONS_RW }} | |
# Automatically create tag on main branch derived from RC Tag on release branch | |
tag_prod: | |
needs: put_test_branch_to_main | |
# if merged code in main/master AND HEAD branch "was" 'release' AND | |
# PR has label 'auto-deploy' | |
if: always() && github.event.pull_request.merged == true && | |
github.event.pull_request.head.ref == 'release' && | |
contains(github.event.pull_request.labels.*.name, 'auto-deploy') | |
uses: ./.github/workflows/go-tag-main.yml | |
with: | |
gh_username: ${{ vars.TAG_USER_NAME }} | |
gh_email: ${{ vars.TAG_USER_EMAIL }} | |
main_branch: ${{ github.event.pull_request.base.ref }} | |
secrets: | |
# needs Content write to create Tag! | |
# needs Actions write to allow other workflows to listen to tag event! | |
GH_PAT_ACTION_RW: ${{ secrets.GA_WORKFLOWS_CI_PR_RW_AND_ACTIONS_RW }} |