-
Notifications
You must be signed in to change notification settings - Fork 2
115 lines (99 loc) · 3.44 KB
/
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
name: Release
on:
push:
branches:
- main
tags:
- 'v*.*.*'
pull_request:
types:
- labeled
jobs:
release:
if: github.event.action != 'labeled'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Bump version on merging Pull Requests with specific labels
id: bumpr
if: "!startsWith(github.ref, 'refs/tags/')"
uses: haya14busa/action-bumpr@v1
- name: Update corresponding major and minor tag
uses: haya14busa/action-update-semver@v1
if: "!steps.bumpr.outputs.skip"
with:
tag: ${{ steps.bumpr.outputs.next_version }}
- name: Get tag name
id: tag
uses: haya14busa/action-cond@v1
with:
cond: "${{ startsWith(github.ref, 'refs/tags/') }}"
if_true: ${{ github.ref }}
if_false: ${{ steps.bumpr.outputs.next_version }}
- id: version_tag
run: echo "::set-output name=tag::$(echo ${{steps.tag.outputs.value}} | cut -c 2-)"
# Update version in Chart.yaml
- if: steps.tag.outputs.value != ''
run: |
sed -i '/^version:/c\version: ${{steps.version_tag.outputs.tag}}' ./helm/prescaling-exporter/Chart.yaml
sed -i '/^appVersion:/c\appVersion: "${{steps.version_tag.outputs.tag}}"' ./helm/prescaling-exporter/Chart.yaml
- if: steps.tag.outputs.value != ''
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "ci: bump charts to ${{steps.version_tag.outputs.tag}}"
- name: Create release
uses: shogo82148/actions-create-release@v1
if: "steps.tag.outputs.value != ''"
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
tag_name: ${{ steps.tag.outputs.value }}
release_name: Release ${{ steps.tag.outputs.value }}
body: ${{ steps.bumpr.outputs.message }}
draft: false
prerelease: false
- uses: actions/setup-go@v4
if: "steps.tag.outputs.value != ''"
with:
go-version: '>=1.18.0'
- name: Login to Docker Hub
uses: docker/login-action@v2
if: "steps.tag.outputs.value != ''"
with:
username: ${{secrets.DOCKER_USERNAME}}
password: ${{ secrets.DOCKER_AUTH_TOKEN }}
- uses: imjasonh/[email protected]
- name: Build and Push on Docker Hub
if: "steps.tag.outputs.value != ''"
env:
KO_DOCKER_REPO: bedrockstreaming/prescaling-exporter
run: ko publish . --bare --tags latest,${{steps.version_tag.outputs.tag}}
release-helm:
needs: [release]
runs-on: ubuntu-latest
steps:
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: 'main'
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Install Helm
uses: azure/setup-helm@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Run chart-releaser
uses: helm/[email protected]
with:
charts_dir: helm
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
release-check:
if: github.event.action == 'labeled'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Post bumpr status comment
uses: haya14busa/action-bumpr@v1