generated from kubernetes/kubernetes-template-project
-
Notifications
You must be signed in to change notification settings - Fork 46
46 lines (44 loc) · 1.68 KB
/
release.yml
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
37
38
39
40
41
42
43
44
45
46
name: Release
on:
workflow_dispatch:
inputs:
releaseVersion:
type: string
required: true
description: The release version of this release. Must be a semantic version of the form X.Y.Z
dry-run:
type: boolean
required: true
description: Dry run, will not push tags to branch and release.
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Validate Input
run: |
echo "${{ github.ref_type }}" | perl -ne 'die unless m/^branch$/'
echo "${{ github.ref_name }}" | perl -ne 'die unless m/^release-\d+\.\d+$/'
echo "${{ github.event.inputs.releaseVersion }}" | perl -ne 'die unless m/^\d+\.\d+\.\d+$/'
- name: Checkout
uses: actions/checkout@v4
- name: Check Actor
run: |
# Release actor should be in the OWNER list
cat OWNERS | grep ${{ github.actor }}
- name: Prepare
run: |
git config user.email "k8s.ci.robot@gmail.com"
git config user.name "Kubernetes Prow Robot"
- name: Release Prepare
run: |
git tag -a v${{ github.event.inputs.releaseVersion }} -m "version ${{ github.event.inputs.releaseVersion }}"
- name: Release Perform
if: ${{ github.event.inputs.dry-run != 'true' }}
run: |
git push https://${{ github.token }}@github.com/${{ github.repository }}.git v${{ github.event.inputs.releaseVersion }}
- name: Publish Release
if: ${{ github.event.inputs.dry-run != 'true' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create -d --generate-notes v${{ github.event.inputs.releaseVersion }}