-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (74 loc) · 2.67 KB
/
release.yml
File metadata and controls
89 lines (74 loc) · 2.67 KB
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
name: release
on:
workflow_dispatch:
push:
branches: [master]
paths: ['chart/Chart.yaml']
jobs:
create-release:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get-version.outputs.version }}
steps:
- name: Check out ${{ github.repository }}
uses: actions/checkout@v4
- name: Check out Devolutions/actions
uses: actions/checkout@v4
with:
repository: Devolutions/actions
ref: v1
token: ${{ secrets.DEVOLUTIONSBOT_TOKEN }}
path: ./.github/workflows
- name: Set version
id: get-version
run: echo "version=$(grep '^version:' chart/Chart.yaml | awk '{print $2}')" >> "$GITHUB_OUTPUT"
- name: Check tag does not already exist
run: |
if gh release view "v${{ steps.get-version.outputs.version }}" &>/dev/null; then
echo "::error::Release v${{ steps.get-version.outputs.version }} already exists. Bump the version in chart/Chart.yaml first."
exit 1
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create release
uses: ./.github/workflows/create-release
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
tag: v${{ steps.get-version.outputs.version }}
publish-helm-chart:
runs-on: ubuntu-latest
needs: create-release
environment: helm-publish
steps:
- name: Check out ${{ github.repository }}
uses: actions/checkout@v4
- name: Install Helm
uses: azure/setup-helm@v4
- name: Package chart
run: helm package chart/
- name: Check out helm-charts repository
uses: actions/checkout@v4
with:
repository: Devolutions/helm-charts
token: ${{ secrets.DEVOLUTIONSBOT_WRITE_TOKEN }}
path: helm-charts
- name: Copy chart package
run: |
mkdir -p helm-charts/devolutions-server
cp devolutions-server-*.tgz helm-charts/devolutions-server/
- name: Update index
working-directory: helm-charts
run: |
if [ -f index.yaml ]; then
helm repo index . --url https://devolutions.github.io/helm-charts --merge index.yaml
else
helm repo index . --url https://devolutions.github.io/helm-charts
fi
- name: Commit and push
working-directory: helm-charts
run: |
git config user.name "devolutionsbot"
git config user.email "bot@devolutions.net"
git add devolutions-server/devolutions-server-*.tgz index.yaml
git commit -m "feat(devolutions-server): add version ${{ needs.create-release.outputs.version }}"
git push