Prepare Deployment Branch #424
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
name: "Prepare Deployment Branch" | |
on: | |
workflow_dispatch: | |
schedule: | |
# 3:00am UTC Tuesdays and Thursdays // 10:00pm EST Mondays and Wednesdays // 7:00pm PST Mondays and Wednesdays (https://crontab.guru/#0_3_*_*_2,4) | |
# GitHub actions run in UTC (and EDT is UTC-4) | |
# If this schedule changes, check any reminders that might be in slack with `/remind list` | |
- cron: "0 3 * * 2,4" | |
jobs: | |
prepare_branch: | |
name: "Prepare the deployment branch and file a PR" | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Check out changes" | |
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 | |
- name: Set Environment Variables | |
run: | | |
DEPLOYMENT_DATE=$(date +%Y-%m-%d) | |
echo >> ${GITHUB_ENV} DEPLOYMENT_DATE=${DEPLOYMENT_DATE?} | |
echo >> ${GITHUB_ENV} BRANCH_NAME=deployment/${DEPLOYMENT_DATE?} | |
- name: Output Branch Name | |
run: | | |
echo "Branch name: \"${BRANCH_NAME}\"" | |
- name: "Create branch '${{ env.BRANCH_NAME }}' to contain the changes for the deployment on ${{ env.DEPLOYMENT_DATE }}" | |
uses: JosiahSiegel/remote-branch-action@dbe7a2138eb064fbfdb980abee918091a7501fbe | |
## DevSecOps - Aquia (Replace) - uses: ./.github/actions/remote-branch-action | |
with: | |
branch: "${{ env.BRANCH_NAME }}" | |
- name: "Prepare a Pull Request from ${{ env.BRANCH_NAME }} into production branch" | |
id: pr | |
uses: JosiahSiegel/reliable-pull-request-action@ae8d0c88126329ee363a35392793d0bc94cb82e7 | |
## DevSecOps - Aquia (Replace) - uses: ./.github/actions/reliable-pull-request-action | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
title: "Deployment of ${{ env.DEPLOYMENT_DATE }}" | |
sourceBranch: "${{ env.BRANCH_NAME }}" | |
targetBranch: "production" | |
labels: DevOps,chore,deployment | |
body: | | |
## Deployment of ${{ env.DEPLOYMENT_DATE }} | |
This PR contains the changes that will go into the deployment scheduled for ${{ env.DEPLOYMENT_DATE }}. | |
- name: "Produce Pull Request URL" | |
run: | | |
echo "PR URL: ${{ steps.pr.outputs.PRURL }}" |