-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add workflow for creating release branches
This change adds a GitHub Actions workflow for creating release branches with steps to generate the THIRD_PARTY_LICENSES file and updates the getting started guide with the new release version. Signed-off-by: Austin Vazquez <[email protected]>
- Loading branch information
1 parent
0615443
commit cbbe038
Showing
3 changed files
with
108 additions
and
10 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: "Update getting started version" | ||
description: "Reusable action to update the getting started version" | ||
inputs: | ||
version: | ||
required: true | ||
description: "Recommended SOCI version" | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: "Update getting started version" | ||
shell: bash | ||
run: | | ||
version=${{ inputs.version }} | ||
version=${version/v/} # strip prefix v if not already stripped | ||
sed -i -E "s/version=\"([0-9]+\.){2}[0-9]+\"/version=\"${version}\"/" docs/getting-started.md | ||
git diff |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
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 |
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