Onboard Release Branches #3
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: Onboard Release Branches | |
on: | |
schedule: | |
- cron: '0 1 * * *' | |
workflow_dispatch: | |
inputs: | |
component: | |
type: string | |
required: true | |
jobs: | |
onboard-release-branches: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: | | |
pip install -r utils/auto-merge/requirements.txt | |
- name: Add the release to config | |
env: | |
SMARTSHEET_ACCESS_TOKEN: ${{ secrets.SMARTSHEET_ACCESS_TOKEN }} | |
BUILD_SHEET_ID: ${{ secrets.BUILD_SHEET_ID }} | |
shell: bash | |
id: remove_release_from_config | |
run: | | |
RELEASE_TO_BE_SETUP=DEFAULT | |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]] | |
then | |
RELEASE_TO_BE_SETUP=${{ github.event.inputs.release }} | |
fi | |
echo "RELEASE_TO_BE_SETUP=$RELEASE_TO_BE_SETUP" | |
echo $RELEASE_TO_BE_SETUP > RELEASE_TO_BE_SETUP | |
python utils/auto-merge/setup_release_branches.py --release $RELEASE_TO_BE_SETUP | |
RELEASE_TO_BE_SETUP=$(cat RELEASE_TO_BE_SETUP) | |
echo "RELEASE_TO_BE_SETUP=${RELEASE_TO_BE_SETUP}" >> $GITHUB_OUTPUT | |
rm -rf RELEASE_TO_BE_SETUP | |
- name: Extract branch name | |
shell: bash | |
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT | |
id: extract_branch | |
- name: Commit and push changes to main branch | |
uses: actions-js/push@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ steps.extract_branch.outputs.branch }} | |
message: "Adding ${{ steps.remove_release_from_config.outputs.RELEASE_TO_BE_SETUP }} to releases.yaml" | |
repository: red-hat-data-services/rhods-devops-infra |