generated from ydataai/go-template
-
Notifications
You must be signed in to change notification settings - Fork 0
117 lines (92 loc) · 2.58 KB
/
merge-master.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
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
name: Merge master
on:
push:
branches:
- master
jobs:
prepare:
name: Calculate Version and Build Number
runs-on:
#- self-hosted
#- small
- ubuntu-22.04
outputs:
build_number: ${{ steps.short_sha.outputs.value }}
new_release: ${{ steps.semantic.outputs.new_release_published }}
release: ${{ steps.semantic.outputs.new_release_version }}
release_notes: ${{ steps.semantic.outputs.new_release_notes }}
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:
dry_run: true
semantic_version: 18.0.1
- name: Git Short sha
id: short_sha
run: echo "value=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
build:
if: needs.prepare.outputs.new_release == 'true'
name: Build
runs-on:
#- self-hosted
#- medium
- ubuntu-22.04
needs:
- prepare
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Cache Go modules
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Build for Test
run: make build
releases:
if: needs.prepare.outputs.new_release == 'true'
name: Dev and Draft Releases
runs-on:
#- self-hosted
#- small
- ubuntu-22.04
needs:
- prepare
- build
steps:
- name: Create Pre Release
uses: actions/create-release@v1
env:
BUILD: ${{ needs.prepare.outputs.build_number }}
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
VERSION: ${{ needs.prepare.outputs.release }}
with:
tag_name: ${{ env.VERSION }}.${{ env.BUILD }}
release_name: ${{ env.VERSION }}.${{ env.BUILD }}
body: ${{ github.event.head_commit.message }}
prerelease: true
- name: Delete Previous drafts
uses: hugo19941994/delete-draft-releases@v1.0.1
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