mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-05 20:42:54 +00:00
104 lines
2.9 KiB
YAML
104 lines
2.9 KiB
YAML
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-latest
|
|
|
|
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: |
|
|
cat << EOF > body.md
|
|
## Release ${RELEASE_DATE}
|
|
|
|
**Please merge this Pull Request using 'Create a merge commit' button**
|
|
EOF
|
|
|
|
gh pr create --title "Release ${RELEASE_DATE}" \
|
|
--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-latest
|
|
|
|
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: |
|
|
cat << EOF > body.md
|
|
## Proxy release ${RELEASE_DATE}
|
|
|
|
**Please merge this Pull Request using 'Create a merge commit' button**
|
|
EOF
|
|
|
|
gh pr create --title "Proxy release ${RELEASE_DATE}" \
|
|
--body-file "body.md" \
|
|
--head "${RELEASE_BRANCH}" \
|
|
--base "release-proxy"
|