-
-
Notifications
You must be signed in to change notification settings - Fork 36
176 lines (148 loc) · 5.47 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
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
name: Extract executable binary, upload artifacts, create release
on:
workflow_run:
workflows:
- "Release - Build and publish docker, and trigger package release"
types:
- "completed"
branches:
- main
- develop
repository_dispatch:
types:
- release-event
jobs:
on-success:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' }} || ${{ github.event_name == 'repositry_dispatch' }}
strategy:
fail-fast: false
matrix:
include:
- target: "gnu"
platform: linux/amd64
- target: "gnu"
platform: linux/arm64
- target: "musl"
platform: linux/amd64
tags-suffix: "-slim"
- target: "musl"
platform: linux/arm64
tags-suffix: "-slim"
- target: "musl"
build-feature: "-slim-pq"
platform: linux/amd64
tags-suffix: "-slim-pq"
- target: "musl"
build-feature: "-slim-pq"
platform: linux/arm64
tags-suffix: "-slim-pq"
- target: "gnu"
build-feature: "-s2n"
platform: linux/amd64
tags-suffix: "-s2n"
- target: "gnu"
build-feature: "-s2n"
platform: linux/arm64
tags-suffix: "-s2n"
- target: "gnu"
build-feature: "-pq"
platform: linux/amd64
tags-suffix: "-pq"
- target: "gnu"
build-feature: "-pq"
platform: linux/arm64
tags-suffix: "-pq"
- target: "gnu"
build-feature: "-s2n-pq"
platform: linux/amd64
tags-suffix: "-s2n-pq"
- target: "gnu"
build-feature: "-s2n-pq"
platform: linux/arm64
tags-suffix: "-s2n-pq"
- target: "gnu"
build-feature: "-webpki-roots"
platform: linux/amd64
tags-suffix: "-webpki-roots"
- target: "gnu"
build-feature: "-webpki-roots"
platform: linux/arm64
tags-suffix: "-webpki-roots"
- target: "musl"
build-feature: "-webpki-roots"
platform: linux/amd64
tags-suffix: "-slim-webpki-roots"
- target: "musl"
build-feature: "-webpki-roots"
platform: linux/arm64
tags-suffix: "-slim-webpki-roots"
- target: "gnu"
build-feature: "-s2n-webpki-roots"
platform: linux/amd64
tags-suffix: "-s2n-webpki-roots"
- target: "gnu"
build-feature: "-s2n-webpki-roots"
platform: linux/arm64
tags-suffix: "-s2n-webpki-roots"
steps:
- run: "echo 'The relese triggering workflows passed'"
- name: "set env"
id: "set-env"
run: |
if [ ${{ matrix.platform }} == 'linux/amd64' ]; then PLATFORM_MAP="x86_64"; else PLATFORM_MAP="aarch64"; fi
if [ ${{ github.ref_name }} == 'main' ]; then BUILD_IMG="latest"; else BUILD_IMG="nightly"; fi
echo "build_img=${BUILD_IMG}" >> $GITHUB_OUTPUT
echo "target_name=rpxy-${PLATFORM_MAP}-unknown-linux-${{ matrix.target }}${{ matrix.build-feature }}" >> $GITHUB_OUTPUT
- name: "docker pull and extract binary from docker image"
id: "extract-binary"
run: |
CONTAINER_ID=`docker create --platform=${{ matrix.platform }} ghcr.io/junkurihara/rust-rpxy:${{ steps.set-env.outputs.build_img }}${{ matrix.tags-suffix }}`
docker cp ${CONTAINER_ID}:/rpxy/bin/rpxy /tmp/${{ steps.set-env.outputs.target_name }}
- name: "upload artifacts"
uses: actions/upload-artifact@v4
with:
name: ${{ steps.set-env.outputs.target_name }}
path: "/tmp/${{ steps.set-env.outputs.target_name }}"
on-failure:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'failure' }}
steps:
- run: echo 'The release triggering workflows failed'
release:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'repository_dispatch' }}
needs: on-success
steps:
- name: check pull_request title
uses: kaisugi/[email protected]
id: regex-match
with:
text: ${{ github.event.client_payload.pull_request.title }}
regex: "^(\\d+\\.\\d+\\.\\d+)$"
- name: checkout
if: ${{ steps.regex-match.outputs.match != '' }}
uses: actions/checkout@v4
- name: download artifacts
if: ${{ steps.regex-match.outputs.match != ''}}
uses: actions/download-artifact@v4
with:
path: /tmp/rpxy
- name: make tar.gz of assets
if: ${{ steps.regex-match.outputs.match != ''}}
run: |
mkdir /tmp/assets
cd /tmp/rpxy
for i in ./*; do sh -c "cd $i && tar zcvf $i.tar.gz $i && mv $i.tar.gz /tmp/assets/"; done
ls -lha /tmp/assets
- name: release
if: ${{ steps.regex-match.outputs.match != ''}}
uses: softprops/action-gh-release@v2
with:
files: /tmp/assets/*.tar.gz
name: ${{ github.event.client_payload.pull_request.title }}
tag_name: ${{ github.event.client_payload.pull_request.title }}
body: ${{ github.event.client_payload.pull_request.body }}
draft: true
prerelease: false
generate_release_notes: true