name: Create Release Branch on: schedule: # It should be kept in sync with if-condition in jobs - cron: '0 6 * * MON' # Storage release - cron: '0 6 * * THU' # Proxy release workflow_dispatch: inputs: create-storage-release-branch: type: boolean description: 'Create Storage release PR' required: false create-proxy-release-branch: type: boolean description: 'Create Proxy release PR' required: false # No permission for GITHUB_TOKEN by default; the **minimal required** set of permissions should be granted in each job. permissions: {} defaults: run: shell: bash -euo pipefail {0} jobs: create-storage-release-branch: if: ${{ github.event.schedule == '0 6 * * MON' || format('{0}', inputs.create-storage-release-branch) == 'true' }} runs-on: ubuntu-22.04 permissions: contents: write # for `git push` steps: - name: Check out code uses: actions/checkout@v4 with: ref: main - name: Set environment variables run: | echo "RELEASE_DATE=$(date +'%Y-%m-%d')" | tee -a $GITHUB_ENV echo "RELEASE_BRANCH=rc/$(date +'%Y-%m-%d')" | tee -a $GITHUB_ENV - name: Create release branch run: git checkout -b $RELEASE_BRANCH - name: Push new branch run: git push origin $RELEASE_BRANCH - name: Create pull request into release env: GH_TOKEN: ${{ secrets.CI_ACCESS_TOKEN }} run: | TITLE="Storage & Compute release ${RELEASE_DATE}" cat << EOF > body.md ## ${TITLE} **Please merge this Pull Request using 'Create a merge commit' button** EOF gh pr create --title "${TITLE}" \ --body-file "body.md" \ --head "${RELEASE_BRANCH}" \ --base "release" create-proxy-release-branch: if: ${{ github.event.schedule == '0 6 * * THU' || format('{0}', inputs.create-proxy-release-branch) == 'true' }} runs-on: ubuntu-22.04 permissions: contents: write # for `git push` steps: - name: Check out code uses: actions/checkout@v4 with: ref: main - name: Set environment variables run: | echo "RELEASE_DATE=$(date +'%Y-%m-%d')" | tee -a $GITHUB_ENV echo "RELEASE_BRANCH=rc/proxy/$(date +'%Y-%m-%d')" | tee -a $GITHUB_ENV - name: Create release branch run: git checkout -b $RELEASE_BRANCH - name: Push new branch run: git push origin $RELEASE_BRANCH - name: Create pull request into release env: GH_TOKEN: ${{ secrets.CI_ACCESS_TOKEN }} run: | TITLE="Proxy release ${RELEASE_DATE}" cat << EOF > body.md ## ${TITLE} **Please merge this Pull Request using 'Create a merge commit' button** EOF gh pr create --title "${TITLE}" \ --body-file "body.md" \ --head "${RELEASE_BRANCH}" \ --base "release-proxy"