-
Notifications
You must be signed in to change notification settings - Fork 0
147 lines (127 loc) · 4.38 KB
/
release.yaml
File metadata and controls
147 lines (127 loc) · 4.38 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
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
name: Release container and chart
env:
IMAGE_PLATFORMS: linux/386,linux/amd64,linux/arm64,linux/arm/v7,linux/ppc64le
on:
push:
branches:
- "main"
paths:
- "docker-image/**"
- "helm/**"
- ".github/workflows/**"
jobs:
generate_infos:
runs-on: ubuntu-latest
outputs:
releaseid: ${{ steps.tag.outputs.releaseid }}
version: ${{ steps.tag.outputs.version }}
pr: ${{ steps.tag.outputs.pr }}
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Setup awesome-ci
uses: fullstack-devops/awesome-ci-action@main
- name: collect infos and create release
run: |
awesome-ci pr info
awesome-ci release create
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: collect infos
id: tag
shell: bash
run: |
echo "::set-output name=version::$ACI_VERSION"
echo "::set-output name=pr::$ACI_PR"
echo "::set-output name=releaseid::$ACI_RELEASE_ID"
build-image:
runs-on: ubuntu-latest
needs: generate_infos
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
with:
platforms: ${{ env.IMAGE_PLATFORMS }}
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Build and push image
uses: docker/build-push-action@v2
with:
builder: ${{ steps.buildx.outputs.name }}
context: ./docker-image/
platforms: ${{ env.IMAGE_PLATFORMS }}
push: true
tags: |
ghcr.io/${{ github.repository }}:latest
ghcr.io/${{ github.repository }}:${{ needs.generate_infos.outputs.version }}
build-helm-chart:
runs-on: ubuntu-latest
needs: generate_infos
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Helm Installation
uses: azure/setup-helm@v1.1
- name: Helm Package
run: helm package ./helm --version "${{ needs.generate_infos.outputs.version }}" --app-version "${{ needs.generate_infos.outputs.version }}" -d out/
- name: Cache build outputs
uses: actions/cache@v2
env:
cache-name: cache-outputs-modules
with:
path: out/
key: dns-bind-${{ github.sha }}-${{ hashFiles('out/dns-bind*') }}
restore-keys: |
dns-bind-${{ github.sha }}
publish_release:
runs-on: ubuntu-latest
needs: [generate_infos, build-image, build-helm-chart]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup awesome-ci
uses: fullstack-devops/awesome-ci-action@main
- name: get cached build outputs
uses: actions/cache@v2
env:
cache-name: cache-outputs-modules
with:
path: out/
key: dns-bind-${{ github.sha }}
- name: Check out helm-charts
uses: actions/checkout@v2
with:
repository: fullstack-devops/helm-charts
token: ${{ secrets.HELM_REPO_TOKEN }}
ref: gh-pages
persist-credentials: true
path: helm-charts
- name: Publish Release
run: awesome-ci release publish -releaseid "$ACI_RELEASE_ID" -assets "file=out/$ARTIFACT1"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ACI_RELEASE_ID: ${{ needs.generate_infos.outputs.releaseid }}
ARTIFACT1: dns-bind-${{ needs.generate_infos.outputs.version }}.tgz
- name: Helm index
env:
CHART_URL: "https://github.com/${{ github.repository }}/releases/download/${{ needs.generate_infos.outputs.version }}"
run: |
export
helm repo index out/ --url "$CHART_URL" --merge helm-charts/index.yaml
cp -f out/index.yaml helm-charts/index.yaml
cd helm-charts
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
git status
git commit index.yaml -m "updated chart dns-bind in index.yaml"
git push
cat index.yaml