Skip to content

Commit f160aaf

Browse files
authored
Merge pull request #4968 from stacks-network/ci/separate-signer-release
Modify Workflow to Build Signer Releases
2 parents 202b45c + b3043a2 commit f160aaf

File tree

8 files changed

+285
-108
lines changed

8 files changed

+285
-108
lines changed

.github/actions/dockerfiles/Dockerfile.alpine-binary

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,18 @@ RUN case ${TARGETPLATFORM} in \
2323
&& unzip ${BIN_ARCH}.zip -d /out
2424

2525
FROM --platform=${TARGETPLATFORM} alpine
26-
COPY --from=builder /out/stacks-node /out/stacks-signer /bin/
27-
CMD ["stacks-node", "mainnet"]
26+
COPY --from=builder /out/* /bin/
27+
ARG TAG
28+
29+
RUN case "${TAG}" in \
30+
signer-*) \
31+
echo "/bin/stacks-signer run --config /signer-config.toml" > /tmp/command.sh \
32+
;; \
33+
*) \
34+
echo "/bin/stacks-node mainnet" > /tmp/command.sh && \
35+
rm /bin/blockstack-cli /bin/clarity-cli /bin/relay-server /bin/stacks-events /bin/stacks-inspect \
36+
;; \
37+
esac && \
38+
chmod +x /tmp/command.sh
39+
40+
CMD ["sh", "-c", "/tmp/command.sh"]

.github/actions/dockerfiles/Dockerfile.debian-binary

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,18 @@ RUN case ${TARGETPLATFORM} in \
2323
&& unzip ${BIN_ARCH}.zip -d /out
2424

2525
FROM --platform=${TARGETPLATFORM} debian:bookworm
26-
COPY --from=builder /out/stacks-node /out/stacks-signer /bin/
27-
CMD ["stacks-node", "mainnet"]
26+
COPY --from=builder /out/* /bin/
27+
ARG TAG
28+
29+
RUN case "${TAG}" in \
30+
signer-*) \
31+
echo "/bin/stacks-signer run --config /signer-config.toml" > /tmp/command.sh \
32+
;; \
33+
*) \
34+
echo "/bin/stacks-node mainnet" > /tmp/command.sh && \
35+
rm /bin/blockstack-cli /bin/clarity-cli /bin/relay-server /bin/stacks-events /bin/stacks-inspect \
36+
;; \
37+
esac && \
38+
chmod +x /tmp/command.sh
39+
40+
CMD ["sh", "-c", "/tmp/command.sh"]

.github/workflows/ci.yml

Lines changed: 75 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ on:
1414
- "**.md"
1515
- "**.yml"
1616
workflow_dispatch:
17-
inputs:
18-
tag:
19-
description: "The tag to create (optional)"
20-
required: false
2117
pull_request:
2218
types:
2319
- opened
@@ -34,7 +30,7 @@ concurrency:
3430
## Always cancel duplicate jobs
3531
cancel-in-progress: true
3632

37-
run-name: ${{ inputs.tag }}
33+
run-name: ${{ github.ref_name }}
3834

3935
jobs:
4036
##
@@ -54,149 +50,169 @@ jobs:
5450
with:
5551
alias: "fmt-stacks"
5652

53+
######################################################################################
54+
## Check if the branch that this workflow is being run against is a release branch
55+
check-release:
56+
name: Check Release
57+
needs:
58+
- rustfmt
59+
runs-on: ubuntu-latest
60+
outputs:
61+
tag: ${{ steps.check_release.outputs.tag }}
62+
docker_tag: ${{ steps.check_release.outputs.docker_tag }}
63+
is_release: ${{ steps.check_release.outputs.is_release }}
64+
steps:
65+
- name: Check Release
66+
id: check_release
67+
uses: stacks-network/actions/stacks-core/check-release@main
68+
with:
69+
tag: ${{ github.ref_name }}
70+
5771
######################################################################################
5872
## Create a tagged github release
5973
##
60-
## Runs when the following is true:
61-
## - tag is provided
74+
## Runs when:
75+
## - it is a release run
6276
create-release:
6377
if: |
64-
inputs.tag != ''
78+
needs.check-release.outputs.is_release == 'true'
6579
name: Create Release
6680
needs:
6781
- rustfmt
82+
- check-release
6883
uses: ./.github/workflows/github-release.yml
6984
with:
70-
tag: ${{ inputs.tag }}
85+
tag: ${{ needs.check-release.outputs.tag }}
86+
docker_tag: ${{ needs.check-release.outputs.docker_tag }}
7187
secrets: inherit
7288

7389
## Build and push Debian image built from source
7490
##
7591
## Runs when:
76-
## - tag is not provided
92+
## - it is not a release run
7793
docker-image:
7894
if: |
79-
inputs.tag == ''
95+
needs.check-release.outputs.is_release != 'true'
8096
name: Docker Image (Source)
8197
uses: ./.github/workflows/image-build-source.yml
8298
needs:
8399
- rustfmt
100+
- check-release
84101
secrets: inherit
85102

86103
## Create a reusable cache for tests
87104
##
88105
## Runs when:
89-
## - tag is provided
106+
## - it is a release run
90107
## or:
91-
## - no tag provided
108+
## - it is not a release run
92109
## and any of:
93110
## - this workflow is called manually
94111
## - PR is opened
95112
## - commit to either (development, master) branch
96113
create-cache:
97114
if: |
98-
inputs.tag != '' || (
99-
inputs.tag == '' && (
100-
github.event_name == 'workflow_dispatch' ||
101-
github.event_name == 'pull_request' ||
102-
github.event_name == 'merge_group' ||
103-
(
104-
contains('
105-
refs/heads/master
106-
refs/heads/develop
107-
refs/heads/next
108-
', github.event.pull_request.head.ref) &&
109-
github.event_name == 'push'
110-
)
115+
needs.check-release.outputs.is_release == 'true' || (
116+
github.event_name == 'workflow_dispatch' ||
117+
github.event_name == 'pull_request' ||
118+
github.event_name == 'merge_group' ||
119+
(
120+
contains('
121+
refs/heads/master
122+
refs/heads/develop
123+
refs/heads/next
124+
', github.event.pull_request.head.ref) &&
125+
github.event_name == 'push'
111126
)
112127
)
113128
name: Create Test Cache
114129
needs:
115130
- rustfmt
131+
- check-release
116132
uses: ./.github/workflows/create-cache.yml
117133

118134
## Tests to run regularly
119135
##
120136
## Runs when:
121-
## - tag is provided
137+
## - it is a release run
122138
## or:
123-
## - no tag provided
139+
## - it is not a release run
124140
## and any of:
125141
## - this workflow is called manually
126142
## - PR is opened
127143
## - PR added to merge queue
128144
## - commit to either (development, next, master) branch
129145
stacks-core-tests:
130146
if: |
131-
inputs.tag != '' || (
132-
inputs.tag == '' && (
133-
github.event_name == 'workflow_dispatch' ||
134-
github.event_name == 'pull_request' ||
135-
github.event_name == 'merge_group' ||
136-
(
137-
contains('
138-
refs/heads/master
139-
refs/heads/develop
140-
refs/heads/next
141-
', github.event.pull_request.head.ref) &&
142-
github.event_name == 'push'
143-
)
147+
needs.check-release.outputs.is_release == 'true' || (
148+
github.event_name == 'workflow_dispatch' ||
149+
github.event_name == 'pull_request' ||
150+
github.event_name == 'merge_group' ||
151+
(
152+
contains('
153+
refs/heads/master
154+
refs/heads/develop
155+
refs/heads/next
156+
', github.event.pull_request.head.ref) &&
157+
github.event_name == 'push'
144158
)
145159
)
146160
name: Stacks Core Tests
147161
needs:
148162
- rustfmt
149163
- create-cache
164+
- check-release
150165
uses: ./.github/workflows/stacks-core-tests.yml
151166

152167
bitcoin-tests:
153168
if: |
154-
inputs.tag != '' || (
155-
inputs.tag == '' && (
156-
github.event_name == 'workflow_dispatch' ||
157-
github.event_name == 'pull_request' ||
158-
github.event_name == 'merge_group' ||
159-
(
160-
contains('
161-
refs/heads/master
162-
refs/heads/develop
163-
refs/heads/next
164-
', github.event.pull_request.head.ref) &&
165-
github.event_name == 'push'
166-
)
169+
needs.check-release.outputs.is_release == 'true' || (
170+
github.event_name == 'workflow_dispatch' ||
171+
github.event_name == 'pull_request' ||
172+
github.event_name == 'merge_group' ||
173+
(
174+
contains('
175+
refs/heads/master
176+
refs/heads/develop
177+
refs/heads/next
178+
', github.event.pull_request.head.ref) &&
179+
github.event_name == 'push'
167180
)
168181
)
169182
name: Bitcoin Tests
170183
needs:
171184
- rustfmt
172185
- create-cache
186+
- check-release
173187
uses: ./.github/workflows/bitcoin-tests.yml
174188

175189
## Test to run on a tagged release
176190
##
177191
## Runs when:
178-
## - tag is provided
192+
## - it is a release run
179193
atlas-tests:
180-
if: inputs.tag != ''
194+
if: needs.check-release.outputs.is_release == 'true'
181195
name: Atlas Tests
182196
needs:
183197
- rustfmt
184198
- create-cache
199+
- check-release
185200
uses: ./.github/workflows/atlas-tests.yml
186201

187202
epoch-tests:
188-
if: inputs.tag != ''
203+
if: needs.check-release.outputs.is_release == 'true'
189204
name: Epoch Tests
190205
needs:
191206
- rustfmt
192207
- create-cache
208+
- check-release
193209
uses: ./.github/workflows/epoch-tests.yml
194210

195211
slow-tests:
196-
if: inputs.tag != ''
212+
if: needs.check-release.outputs.is_release == 'true'
197213
name: Slow Tests
198214
needs:
199215
- rustfmt
200216
- create-cache
217+
- check-release
201218
uses: ./.github/workflows/slow-tests.yml
202-

.github/workflows/github-release.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ on:
99
description: "Release Tag"
1010
required: true
1111
type: string
12+
docker_tag:
13+
description: "Docker Release Tag"
14+
required: true
15+
type: string
1216
secrets:
1317
GH_TOKEN:
1418
required: true
@@ -68,8 +72,8 @@ jobs:
6872
env:
6973
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
7074
with:
71-
name: Release ${{ github.event.inputs.tag || github.ref }}
72-
tag_name: ${{ github.event.inputs.tag || github.ref }}
75+
name: Release ${{ inputs.tag || github.ref }}
76+
tag_name: ${{ inputs.tag || github.ref }}
7377
draft: false
7478
prerelease: true
7579
fail_on_unmatched_files: true
@@ -94,4 +98,5 @@ jobs:
9498
- create-release
9599
with:
96100
tag: ${{ inputs.tag }}
101+
docker_tag: ${{ inputs.docker_tag }}
97102
secrets: inherit

0 commit comments

Comments
 (0)