-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (48 loc) · 1.4 KB
/
create-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
47
48
49
50
51
52
53
name: Release
on:
pull_request:
types:
- closed
branches:
- 'main'
jobs:
test:
name: Test
if: github.event.pull_request.merged == true && github.head_ref == 'release'
uses: Mobelux/Watcher/.github/workflows/tests.yml@main
release:
name: Release
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true && github.head_ref == 'release'
needs: test
steps:
- name: Git checkout
uses: actions/checkout@v4
- name: Get version
id: get-version
shell: bash
run: |
VERSION=$(grep -Eo '([0-9]+\.*)+' ${{ vars.VERSION_FILE_PATH }})
echo "current-version=$VERSION" >> $GITHUB_ENV
- name: Push tag
uses: actions/github-script@v7
with:
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/${{ env.current-version }}',
sha: '${{ github.sha }}'
})
- name: Create release
uses: actions/github-script@v7
with:
script: |
github.rest.repos.createRelease({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: '${{ env.current-version }}',
generate_release_notes: true,
draft: false,
prerelease: false
})