-
Notifications
You must be signed in to change notification settings - Fork 0
36 lines (33 loc) · 1.38 KB
/
create-release.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
name: Init Release
on:
workflow_dispatch:
inputs:
TARGET_VERSION:
description: 'TARGET_VERSION to build manifests (e.g. 2.5.0-rc1) Note: the `v` prefix is not used'
required: true
type: string
jobs:
prepare-release:
permissions:
contents: write # for peter-evans/create-pull-request to create branch
pull-requests: write # for peter-evans/create-pull-request to create a PR
name: Automatically generate version and manifests on ${{ inputs.TARGET_VERSION }}
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: releases/${{ inputs.TARGET_VERSION }}
- name: Check if TARGET_VERSION is well formed.
run: |
set -xue
# Target version must not contain 'v' prefix
if echo "${{ inputs.TARGET_VERSION }}" | grep -e '^v'; then
echo "::error::Target version '${{ inputs.TARGET_VERSION }}' should not begin with a 'v' prefix, refusing to continue." >&2
exit 1
fi
- name: create pull request
run: gh pr create -H main -B releases/${{ inputs.TARGET_VERSION }} --title 'Create new branch releases/${{ inputs.TARGET_VERSION }} from main' --body 'Create new version ${{ inputs.TARGET_VERSION }}'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}