generated from actions/javascript-action
-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (65 loc) · 2.14 KB
/
merge-main.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
name: Merge into main branch
on:
push:
branches:
- main
jobs:
prepare:
name: Calculate Version and Build Number
runs-on: ubuntu-22.04
outputs:
build_number: ${{ steps.build_number.outputs.value }}
new_release: ${{ steps.semantic.outputs.new_release_published }}
release: v${{ steps.semantic.outputs.new_release_version }}
release_notes: ${{ steps.semantic.outputs.new_release_notes }}
version: v${{ steps.version.outputs.value }}
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.ACCESS_TOKEN }}
- uses: cycjimmy/semantic-release-action@v3
id: semantic
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
with:
branch: main
dry_run: true
- name: Count number or releases for tag
id: build_number
run: echo "value=$(($(git tag | grep -c ${{ steps.semantic.outputs.new_release_version }}.rc) + 1))" >> $GITHUB_OUTPUT
- name: Compute version
id: version
run: echo "value=${{ steps.semantic.outputs.new_release_version }}.rc${{ steps.build_number.outputs.value }}" >> $GITHUB_OUTPUT
prerelease-tag:
if: needs.prepare.outputs.new_release == 'true'
name: Create Prerelease Tag
runs-on: ubuntu-22.04
needs:
- prepare
steps:
- uses: actions/checkout@v4
- uses: ./../create-tag
with:
tag: ${{ needs.prepare.outputs.version }}
message: ${{ github.event.head_commit.message }}
github_token: ${{ secrets.ACCESS_TOKEN }}
draft-release:
if: needs.prepare.outputs.new_release == 'true'
name: Draft Release
runs-on: ubuntu-22.04
needs:
- prepare
steps:
- name: Delete Previous drafts
uses: hugo19941994/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
- name: Create Draft Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
with:
tag_name: ${{ needs.prepare.outputs.release }}
release_name: ${{ needs.prepare.outputs.release }}
body: ${{ needs.prepare.outputs.release_notes }}
draft: true