This repository has been archived by the owner on Jan 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
152 lines (140 loc) · 5.41 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
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
name: Create release
on:
workflow_dispatch:
env:
KEPTN_BOT_NAME: "Keptn Contrib Bot"
KEPTN_BOT_EMAIL: "[email protected]"
VERSION_FILE: "x-release-please-version.json"
defaults:
run:
shell: bash
jobs:
prepare:
name: Prepare release run
runs-on: ubuntu-20.04
if: startsWith(github.ref, 'refs/heads/release-')
outputs:
branch: ${{ steps.current_branch.outputs.branch }}
steps:
- name: Checkout repo
uses: actions/[email protected]
with:
fetch-depth: 0
token: ${{ secrets.KEPTN_BOT_TOKEN }}
- name: Find current branch
id: current_branch
run: |
branch=${GITHUB_REF#refs/heads/}
echo "branch=${branch}" >> $GITHUB_OUTPUT
############################################################################
# Create Release
############################################################################
release-please:
needs:
- prepare
runs-on: ubuntu-20.04
name: Release please
if: startsWith(github.ref, 'refs/heads/release-')
outputs:
release_created: ${{ steps.release_please.outputs.release_created }}
tag_name: ${{ steps.release_please.outputs.tag_name }}
major: ${{ steps.release_please.outputs.major }}
minor: ${{ steps.release_please.outputs.minor }}
patch: ${{ steps.release_please.outputs.patch }}
steps:
- name: Release please
env:
KEPTN_BOT_NAME: ${{ env.KEPTN_BOT_NAME }}
KEPTN_BOT_EMAIL: ${{ env.KEPTN_BOT_EMAIL }}
id: release_please
uses: google-github-actions/[email protected]
with:
command: github-release
release-type: go
package-name: dynatrace-service
changelog-path: CHANGELOG.md
default-branch: ${{ needs.prepare.outputs.branch }}
bump-minor-pre-major: true
bump-patch-for-minor-pre-major: false
include-v-in-tag: false
signoff: "${{ env.KEPTN_BOT_NAME }} <${{ env.KEPTN_BOT_EMAIL }}>"
pull-request-title-pattern: "build: release ${component} ${version}"
extra-files: |
${{ env.VERSION_FILE }}
changelog-types: |
[{"type":"feat","section":"Features","hidden":false},
{"type":"fix","section":"Bug Fixes","hidden":false},
{"type":"chore","section":"Other","hidden":false},
{"type":"docs","section":"Docs","hidden":false},
{"type":"perf","section":"Performance","hidden":false},
{"type":"refactor","section":"Refactoring","hidden":false},
{"type":"build","section":"Build","hidden":true},
{"type":"ci","section":"CI","hidden":true},
{"type":"revert","section":"Revert","hidden":true},
{"type":"style","section":"Style","hidden":true},
{"type":"test","section":"Test","hidden":true}]
############################################################################
# Build Docker Image
############################################################################
docker_build:
needs:
- release-please
name: Build Docker Image
if: ${{ needs.release-please.outputs.release_created }}
runs-on: ubuntu-20.04
env:
VERSION: ${{ needs.release-please.outputs.major }}.${{ needs.release-please.outputs.minor }}.${{ needs.release-please.outputs.patch }}
steps:
- name: Checkout Code
uses: actions/[email protected]
# load DOCKER_ORGANIZATION & IMAGE variable from .ci_env
- name: Load CI Environment from .ci_env
id: load_ci_env
uses: c-py/action-dotenv-to-setenv@v4
with:
env-file: .ci_env
- name: Docker Build
uses: keptn/gh-automation/.github/actions/[email protected]
with:
TAGS: |
${{ env.DOCKER_ORGANIZATION }}/${{ env.IMAGE }}:${{ env.VERSION }}
BUILD_ARGS: |
version=${{ env.VERSION }}
REGISTRY_USER: ${{ secrets.REGISTRY_USER }}
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
############################################################################
# Build Helm Chart
############################################################################
build-helm-chart:
needs:
- release-please
name: Build Helm Charts
if: ${{ needs.release-please.outputs.release_created }}
uses: ./.github/workflows/build-helm-chart.yml
with:
branch: ${{ needs.prepare.outputs.branch }}
version: ${{ needs.release-please.outputs.major }}.${{ needs.release-please.outputs.minor }}.${{ needs.release-please.outputs.patch }}
release: true
############################################################################
# Release
############################################################################
release:
name: "Release"
runs-on: ubuntu-20.04
needs:
- release-please
- docker_build
- build-helm-chart
steps:
- name: Download Release Artifacts
if: ${{ needs.release-please.outputs.release_created }}
uses: actions/download-artifact@v3
with:
path: ./dist
- name: Add artifacts to release
id: add_artifacts_to_release
uses: softprops/action-gh-release@v1
if: ${{ needs.release-please.outputs.release_created }}
with:
tag_name: ${{ needs.release-please.outputs.tag_name }}
files: "./dist/installer/*.tgz"