-
Notifications
You must be signed in to change notification settings - Fork 0
155 lines (136 loc) · 4.65 KB
/
release.yaml
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
152
153
154
155
name: release
on:
push:
branches:
- master
tags:
- "v*"
pull_request:
branches:
- "master"
workflow_dispatch:
inputs:
version:
description: 'Version to release'
required: true
default: 'latest'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: meta
uses: docker/metadata-action@v5
with:
images: |
m1cr/netcheck
ghcr.io/m1/netcheck
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: login to ghcr
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
publish-release:
if: startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch'
permissions:
contents: write
runs-on: ubuntu-latest
# strategy:
# fail-fast: false
# matrix:
# include:
# - target: x86_64-pc-windows-gnu
# archive: zip
# - target: x86_64-unknown-linux-musl
# archive: tar.gz tar.bz2 tar.xz
#
# ```
# - target: x86_64-apple-darwin
# archive: zip
# ```
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: dtolnay/rust-toolchain@stable
- run: |
if [ "${GITHUB_REF##*/}" = main ]; then
echo "VERSION=latest" >> "$GITHUB_ENV"
echo "Setting version to latest"
elif [ "${GITHUB_EVENT_NAME}" == "workflow_dispatch" ]; then
echo "VERSION=${{ github.event.inputs.version }}" >> "$GITHUB_ENV"
echo "Setting version to ${{ github.event.inputs.version }}"
else
echo "VERSION=${GITHUB_REF##*/}" >> "$GITHUB_ENV"
echo "Setting version to ${GITHUB_REF##*/}"
fi
# @TODO<hello@milescroxford.com> - 2024-03-08: Add support for darwin,
# see: https://github.com/rust-build/rust-build.action/issues/88
- uses: rust-build/rust-build.action@v1.4.5
id: build_linux
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
MINIFY: true
RUSTTARGET: x86_64-unknown-linux-musl
ARCHIVE_TYPES: tar.gz tar.bz2 tar.xz
ARCHIVE_NAME: netcheck_${{ env.VERSION }}_linux_x86_64
EXTRA_FILES: "README.md LICENSE"
STATIC_LINKING: false
- uses: rust-build/rust-build.action@v1.4.5
id: build_windows
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
MINIFY: true
RUSTTARGET: x86_64-pc-windows-gnu
ARCHIVE_TYPES: zip
ARCHIVE_NAME: netcheck_${{ env.VERSION }}_windows_x86_64
EXTRA_FILES: "README.md LICENSE"
STATIC_LINKING: false
- uses: azure/setup-helm@v4
with:
version: v3.8.0
- run: helm template charts/netcheck --output-dir ./helm-template
- run: |
cd charts/netcheck; zip ../../netcheck_${{ env.VERSION }}_chart.zip -r ./*; cd -
cd helm-template/netcheck/templates; zip ../../../netcheck_${{ env.VERSION }}_k8s_manifests.zip -r ./*; cd -
- uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
generate_release_notes: true
prerelease: true
files: |
${{ steps.build_linux.outputs.BUILT_ARCHIVE }}
${{ steps.build_linux.outputs.BUILT_CHECKSUM }}
${{ steps.build_windows.outputs.BUILT_ARCHIVE }}
${{ steps.build_windows.outputs.BUILT_CHECKSUM }}
netcheck_${{ env.VERSION }}_chart.zip
netcheck_${{ env.VERSION }}_k8s_manifests.zip