-
Notifications
You must be signed in to change notification settings - Fork 2
128 lines (105 loc) · 3.61 KB
/
draft-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
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
118
119
120
121
122
123
124
125
126
127
128
name: Create Draft Release
on:
push:
# We trigger this workflow on tag pushes that match v* (eg. `v1.2.3`)
tags:
- 'v*'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
# This job name must match the `needs` field in `release` step
run-tests:
# This is mostly a copy/paste from test.yml
name: Run Unit Tests
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.17
uses: actions/setup-go@v2
with:
go-version: 1.17
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Run Tests
run: go test -v -coverprofile=c.out -count=1 ./...
release:
name: Create Draft Release
runs-on: ubuntu-latest
needs: run-tests
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Set up Go 1.17
uses: actions/setup-go@v2
with:
go-version: 1.17
- name: Set up version info
id: get_version
uses: battila7/get-version-action@v2
- name: Add suite.yml to artifacts
uses: actions/upload-artifact@v1
with:
path: ./suite.yml
name: suite.yml
- name: Generate RELEASE_NOTES.md
run: go run cmd/changelog-parser/main.go -v "${{ steps.get_version.outputs.version }}" -t release -o tmp_RELEASE_NOTES.md
- name: Add RELEASE_NOTES to artifacts
uses: actions/upload-artifact@v1
with:
path: ./tmp_RELEASE_NOTES.md
name: RELEASE_NOTES.md
- name: Generate CHANGELOG.md
run: go run cmd/changelog-parser/main.go -v "${{ steps.get_version.outputs.version }}" -o tmp_CHANGELOG.md
- name: Add CHANGELOG to artifacts
uses: actions/upload-artifact@v1
with:
path: ./tmp_CHANGELOG.md
name: CHANGELOG.md
- name: Generate ConjurSuite.htm
run: go run cmd/changelog-parser/main.go -v "${{ steps.get_version.outputs.version }}" -t docs-release -o tmp_ConjurSuite.htm
- name: Add ConjurSuite to artifacts
uses: actions/upload-artifact@v1
with:
path: ./tmp_ConjurSuite.htm
name: ConjurSuite.htm
- name: Capture release notes into a variable
id: release_notes
run: |
CONTENT=$(cat tmp_RELEASE_NOTES.md)
echo "::set-output name=content::${CONTENT//$'\n'/%0A}"
- name: Create Release
id: create_release
uses: actions/create-release@v1
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
body: ${{ steps.release_notes.outputs.content }}
draft: true
prerelease: true
- name: Upload RELEASE_NOTES to release
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./tmp_RELEASE_NOTES.md
asset_name: RELEASE_NOTES.md
asset_content_type: text/markdown
- name: Upload CHANGELOG to release
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./tmp_CHANGELOG.md
asset_name: CHANGELOG.md
asset_content_type: text/markdown
- name: Upload ConjurSuite to release
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./tmp_ConjurSuite.htm
asset_name: ConjurSuite.htm
asset_content_type: text/html
- name: Upload suite.yml to release
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./suite.yml
asset_name: suite.yml
asset_content_type: text/x-yaml