-
Notifications
You must be signed in to change notification settings - Fork 2
52 lines (46 loc) · 1.67 KB
/
create-release.yaml
File metadata and controls
52 lines (46 loc) · 1.67 KB
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
47
48
49
50
51
52
name: Create Release
on:
workflow_dispatch:
inputs:
version:
description: "Version to release"
required: true
type: string
jobs:
create-release:
runs-on: ubuntu-latest
steps:
- name: Parse input
id: input
run: |
SEMVER_REGEX="^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(\\-[0-9A-Za-z-]+(\\.[0-9A-Za-z-]+)*)?(\\+[0-9A-Za-z-]+(\\.[0-9A-Za-z-]+)*)?$"
[[ ${{ github.event.inputs.version }} =~ $SEMVER_REGEX ]]
echo "version=v${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
- name: Checkout
uses: actions/checkout@v4
with:
ssh-key: ${{ secrets.KNIT_RELEASE_BOT_SSH_KEY }}
- name: Check tag
run: |
if [ $(git tag -l ${{ steps.input.outputs.version }}) ]; then
echo "Tag already exists for release"
exit 1
else
echo "Proceeding with release with tag ${{ steps.input.outputs.version }}"
fi
- name: Update action
run: |
yq e -i '.runs.image = "docker://ghcr.io/tvandinther/knit:${{ steps.input.outputs.version }}"' action.yaml
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
git add action.yaml
if [[ -n "$(git status --porcelain)" ]]; then
git commit -m "Update image tag in action.yaml to ${{ steps.input.outputs.version }}"
git push origin
else
echo "No changes to commit"
fi
- name: Create release tag
run: |
git tag ${{ steps.input.outputs.version }}
git push --tags