-
Notifications
You must be signed in to change notification settings - Fork 1
181 lines (146 loc) · 6.58 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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
name: Release
# READ THIS FIRST
#
# This process is by no means perfect, but it currently achieves our goals
#
# There's some magic in the `Check version match` step for each job,
# but it's there's a reason — i.e. GHA sucks — and we want to only build the package for the respective tag
# this allows us to perform individual releases instead of launching them all one by one.
#
# Now, on to the magic:
# 1 - Start by fetching the workspace metadata
# 2 - Using `jq`, get the package name and version
# and then format them into a string that should match the tag
# 4 - If it does not match the tag, fail the build
on:
push:
tags:
# We match on all tags and filter them later
- "**"
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
jobs:
build_and_release_mater_cli:
runs-on: self-hosted
permissions:
contents: read
packages: write
if: github.ref_type == 'tag' && startsWith(github.ref_name, 'mater-cli-v')
steps:
- uses: actions/[email protected]
- name: Check version match
run: |
PACKAGE_VERSION="$(cargo metadata --no-deps --color never --format-version 1 --locked |
jq -r '.packages[] | select(.name == "mater-cli") | "\(.name)-v\(.version)"')"
if [[ "$PACKAGE_VERSION" != "$GITHUB_REF_NAME" ]]; then
exit 1;
fi
# - name: Build in release mode
# run: RUSTFLAGS="-D warnings" cargo build --release --locked --package mater-cli
# - name: Release binaries
# uses: softprops/action-gh-release@v2
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # set github token for rw rights on repo
# with:
# tag_name: ${{ github.ref_name }} # set the name of the release the tag
# files: |
# target/release/mater-cli
- name: Login to Github Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and publish image
run: |
docker build --build-arg VCS_REF="$(git rev-parse HEAD)" --build-arg BUILD_DATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')" --tag ghcr.io/eigerco/mater-cli:"$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[0].version')" --file ./docker/dockerfiles/mater-cli.Dockerfile .
docker push ghcr.io/eigerco/mater-cli:$(cargo metadata --no-deps --color never --format-version 1 --locked | jq -r '.packages[].version')
build_and_release_storagext_cli:
runs-on: self-hosted
if: github.ref_type == 'tag' && startsWith(github.ref_name, 'storagext-cli-v')
steps:
- uses: actions/[email protected]
- name: Check version match
run: |
PACKAGE_VERSION="$(cargo metadata --no-deps --color never --format-version 1 --locked |
jq -r '.packages[] | select(.name == "storagext-cli") | "\(.name)-v\(.version)"')"
if [[ "$PACKAGE_VERSION" != "$GITHUB_REF_NAME" ]]; then
exit 1;
fi
- name: Build in release mode
run: RUSTFLAGS="-D warnings" cargo build --release --locked --package storagext-cli
- name: Release binaries
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # set github token for rw rights on repo
with:
tag_name: ${{ github.ref_name }} # set the name of the release the tag
files: |
target/release/storagext-cli
build_and_release_polka_storage_node:
runs-on: self-hosted
if: github.ref_type == 'tag' && startsWith(github.ref_name, 'polka-storage-node-v')
steps:
- uses: actions/[email protected]
- name: Check version match
run: |
PACKAGE_VERSION="$(cargo metadata --no-deps --color never --format-version 1 --locked |
jq -r '.packages[] | select(.name == "polka-storage-node") | "\(.name)-v\(.version)"')"
if [[ "$PACKAGE_VERSION" != "$GITHUB_REF_NAME" ]]; then
exit 1;
fi
- name: Build in release mode
run: RUSTFLAGS="-D warnings" cargo build --release --locked --package polka-storage-node
- name: Release binaries
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # set github token for rw rights on repo
with:
tag_name: ${{ github.ref_name }} # set the name of the release the tag
files: |
target/release/polka-storage-node
build_and_release_polka_storage_provider_server:
runs-on: self-hosted
if: github.ref_type == 'tag' && startsWith(github.ref_name, 'polka-storage-provider-server-v')
steps:
- uses: actions/[email protected]
- name: Check version match
run: |
PACKAGE_VERSION="$(cargo metadata --no-deps --color never --format-version 1 --locked |
jq -r '.packages[] | select(.name == "polka-storage-server") | "\(.name)-v\(.version)"')"
if [[ "$PACKAGE_VERSION" != "$GITHUB_REF_NAME" ]]; then
exit 1;
fi
- name: Build in release mode
run: RUSTFLAGS="-D warnings" cargo build --release --locked --package polka-storage-provider-server
- name: Release binaries
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # set github token for rw rights on repo
with:
tag_name: ${{ github.ref_name }} # set the name of the release the tag
files: |
target/release/polka-storage-provider-server
build_and_release_polka_storage_provider_client:
runs-on: self-hosted
if: github.ref_type == 'tag' && startsWith(github.ref_name, 'polka-storage-provider-client-v')
steps:
- uses: actions/[email protected]
- name: Check version match
run: |
PACKAGE_VERSION="$(cargo metadata --no-deps --color never --format-version 1 --locked |
jq -r '.packages[] | select(.name == "polka-storage-client") | "\(.name)-v\(.version)"')"
if [[ "$PACKAGE_VERSION" != "$GITHUB_REF_NAME" ]]; then
exit 1;
fi
- name: Build in release mode
run: RUSTFLAGS="-D warnings" cargo build --release --locked --package polka-storage-provider-client
- name: Release binaries
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # set github token for rw rights on repo
with:
tag_name: ${{ github.ref_name }} # set the name of the release the tag
files: |
target/release/polka-storage-provider-client