-
Notifications
You must be signed in to change notification settings - Fork 1
46 lines (42 loc) · 1.19 KB
/
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
37
38
39
40
41
42
43
44
45
46
name: Release Action
on:
workflow_dispatch:
inputs:
ref:
description: 'Ref'
required: true
default: 'main'
version:
description: 'Version'
required: true
jobs:
release:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
- name: Create Release
uses: actions/github-script@v7
env:
INPUT_REF: ${{ inputs.ref }}
INPUT_VERSION: ${{ inputs.version }}
with:
script: |
await github.rest.repos.createRelease({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: 'v' + core.getInput('version'),
target_commitish: core.getInput('ref'),
})
- name: Move Major Version Tag
env:
INPUT_VERSION: ${{ inputs.version }}
run: |
# move the major version tag e.g. v1
MAJOR_INPUT_VERSION="${INPUT_VERSION%%.*}"
MAJOR_VERSION_TAG="v${MAJOR_INPUT_VERSION}"
git tag --force "${MAJOR_VERSION_TAG}"
git push --force origin "${MAJOR_VERSION_TAG}"