Skip to content

Add create release branch workflow #4

Add create release branch workflow

Add create release branch workflow #4

name: Create release branch
on:
workflow_dispatch:
inputs:
major_minor_version:
description: 'Major.Minor release version'
required: true
base_commit:
description: 'Base commit SHA'
required: true
pull_request:
branches: ['main']
paths:
- '.github/workflows/create-release-branch.yml'
permissions:
contents: write
pull-requests: write
jobs:
create-branch:
runs-on: ubuntu-20.04
env:
MAJOR_MINOR_VERSION: ''
BASE_COMMIT: ''
steps:
- uses: actions/checkout@v4
- name: Mock workflow inputs on pull request
if: github.event_name == 'pull_request'
run: |
echo "MAJOR_MINOR_VERSION=pr.${{ github.event.pull_request.number }}" >> $GITHUB_ENV
- name: Set environment variables for workflow
if: github.event_name == 'workflow_dispatch'
run: |
echo "MAJOR_MINOR_VERSION=${{ github.event.inputs.major_minor_version }}" >> $GITHUB_ENV
echo "BASE_COMMIT=${{ github.event.inputs.base_commit }}" >> $GITHUB_ENV
- name: Create release branch
run: git checkout -b release/${{ env.MAJOR_MINOR_VERSION }} ${{ env.BASE_COMMIT }}
- name: Push new release branch
if: github.event_name == 'workflow_dispatch'
run: git push origin release/${{ env.MAJOR_MINOR_VERSION }}
- uses: ./.github/actions/update-getting-started
with:
version: ${{ env.MAJOR_MINOR_VERSION }}.0
- uses: actions/setup-go@v5
- name: Install go-licenses
run: go install github.com/google/[email protected]
- name: Generate third party licenses file
run: scripts/build-third-party-licenses.sh
- name: Create PR
if: github.event_name == 'workflow_dispatch'
uses: peter-evans/create-pull-request@v6
with:
title: 'Prepare release ${{ env.MAJOR_MINOR_VERSION }}'
commit-message: |
Prepare release ${{ env.MAJOR_MINOR_VERSION }}
This change adds the THIRD_PARTY_LICENSES file and updates the getting started guide for release/${{ env.MAJOR_MINOR_VERSION }}.
body: |
This change adds the THIRD_PARTY_LICENSES file and updates the getting started guide for release/${{ env.MAJOR_MINOR_VERSION }}.
Auto-generated by [create-pull-request](https://github.com/peter-evans/create-pull-request)
labels: easy-to-review, automated-pr
token: ${{ secrets.GITHUB_TOKEN }}
author: "GitHub <[email protected]>"
signoff: true
branch: 'create-pull-request/prepare-release-${{ env.MAJOR_MINOR_VERSION }}'
base: 'release/${{ env.MAJOR_MINOR_VERSION }}'
delete-branch: true