Add create release branch workflow #3
Workflow file for this run
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: Create release branch | |
on: | |
workflow_dispatch: | |
inputs: | |
major_minor_version: | |
description: | | |
Major.Minor release version | |
(e.g. 0.6) | |
required: true | |
base_commit: | |
description: | | |
Base commit SHA | |
(e.g. be8940b39667bc3975cf7ea8a71177e4bfb5f6e0) | |
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 | |
echo "BASE_COMMIT=${{ github.event.pull_request.head.sha }}" >> $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 |