-
Notifications
You must be signed in to change notification settings - Fork 139
674 lines (587 loc) · 23.9 KB
/
ci.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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
name: CI
on:
pull_request:
push:
branches:
- main
- develop
- rc/next
paths-ignore:
- '**/CHANGELOG.md'
- 'docs/**'
workflow_dispatch:
jobs:
pre_run:
name: Cancel previous runs
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@ad6cb1b847ffb509a69b745b6ee2f1d14dfe14b8
with:
access_token: ${{ github.token }}
persist-credentials: false
get_release_info:
name: Get Release Info
runs-on: ubuntu-latest
needs: pre_run
outputs:
tag: ${{ steps.new_release_tag.outputs.TAG }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Get latest release
if: startsWith(github.ref, 'refs/heads/main')
id: release
uses: pozetroninc/github-action-get-latest-release@master
with:
repository: ${{ github.repository }}
excludes: prerelease, draft
- name: Determine if release build
if: startsWith(github.ref, 'refs/heads/main')
id: new_release_tag
env:
LATEST_RELEASE: ${{ steps.release.outputs.release }}
run: |
CARGO_VERSION=v$(grep "version" components/clarinet-cli/Cargo.toml | head -n 1 | cut -d\" -f2)
if [[ "${CARGO_VERSION}" != "${LATEST_RELEASE}" ]]; then
echo "::set-output name=TAG::${CARGO_VERSION}"
echo "::warning::Will create release for version: ${CARGO_VERSION}"
else
echo "::warning::Will not create a release"
fi
audit:
name: Audit and format
runs-on: ubuntu-latest
needs: pre_run
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: recursive
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
components: rustfmt
override: true
- name: Set Cargo file permissions
run: sudo chown -R $(whoami):$(id -ng) ~/.cargo/
- name: Cache cargo
uses: actions/cache@v2
with:
path: ~/.cargo/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install dependencies
run: cargo install cargo-audit
- name: Run audit
run: cargo audit --ignore RUSTSEC-2021-0076 --ignore RUSTSEC-2022-0028 --ignore RUSTSEC-2020-0071 --ignore RUSTSEC-2022-0090 --ignore RUSTSEC-2023-0018
- name: Run rustfmt
run: cargo fmt --all -- --check
# test_coverage_cargo:
# name: Generate test coverage
# runs-on: ubuntu-latest
# needs: pre_run
# strategy:
# fail-fast: false
# matrix:
# include:
# - name: clarinet
# working-directory: components/clarinet-cli
# - name: clarity-repl
# working-directory: components/clarity-repl
# steps:
# - name: Checkout repository
# uses: actions/checkout@v3
# with:
# submodules: recursive
# - name: Install Rust toolchain stable
# uses: actions-rs/toolchain@v1
# with:
# toolchain: stable
# profile: minimal
# override: true
# - name: Cache cargo
# uses: actions/cache@v2
# id: cache-cargo
# with:
# path: |
# ~/.cargo/bin/
# ~/.cargo/registry/index/
# ~/.cargo/registry/cache/
# ~/.cargo/git/db/
# target/
# key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
# - name: Install dependencies
# if: steps.cache-cargo.outputs.cache-hit != 'true'
# run: RUSTC_BOOTSTRAP=1 cargo install grcov
# - name: Install Rust toolchain
# uses: actions-rs/toolchain@v1
# with:
# toolchain: stable
# profile: minimal
# components: llvm-tools-preview
# override: true
# - name: Unit Tests
# env:
# RUSTFLAGS: "-C instrument-coverage"
# LLVM_PROFILE_FILE: "${{ matrix.name }}-%p-%m.profraw"
# run: cargo build --package=clarinet-cli --locked && cargo test --package=clarinet-cli
# - name: Generate coverage
# run: grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore "/*" -o lcov.info
# # Run functional tests here in addition to the other jobs so we can fail fast
# # Since these tests are reached much earlier in the pipeline
# - name: Functional Tests
# if: matrix.name == 'clarinet'
# run: |
# for testdir in $(ls components/clarinet-cli/examples); do
# ./target/debug/clarinet test --manifest-path components/clarinet-cli/examples/${testdir}/Clarinet.toml
# done
# - name: Upload coverage report
# uses: codecov/codecov-action@v1
# with:
# flags: unittests
# name: ${{ matrix.name }}
# verbose: true
dist_clarinet:
name: Build Clarinet Distributions
runs-on: ${{ matrix.os }}
needs: pre_run
# Related upstream issue:
# https://github.com/nagisa/rust_libloading/issues/61#issuecomment-607941377
#
# env:
# CC: deny_c
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
platform: linux
target: x86_64-unknown-linux-gnu
architecture: x64
libc: glibc
- os: windows-latest
platform: windows
target: x86_64-pc-windows-msvc
architecture: x64
- os: macos-latest
platform: darwin
target: x86_64-apple-darwin
architecture: x64
- os: macos-latest
platform: darwin
target: aarch64-apple-darwin
architecture: arm64
steps:
- name: Configure git to use LF (Windows)
if: matrix.os == 'windows-latest'
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: recursive
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
profile: minimal
components: llvm-tools-preview
override: true
- name: Install wix (Windows)
if: matrix.os == 'windows-latest'
run: cargo install cargo-wix
- if: matrix.os != 'windows-latest'
run: sudo chown -R $(whoami):$(id -ng) ~/.cargo/
- name: Cache cargo
uses: actions/cache@v2
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/${{ matrix.target }}/release/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
# Set environment variables required from cross compiling from macos-x86_64 to macos-arm64
- name: Configure macos-arm64 cross compile config
if: matrix.target == 'aarch64-apple-darwin'
run: |
echo "SDKROOT=$(xcrun -sdk macosx --show-sdk-path)" >> $GITHUB_ENV
echo "MACOSX_DEPLOYMENT_TARGET=$(xcrun -sdk macosx --show-sdk-platform-version)" >> $GITHUB_ENV
- name: Configure artifact names (libc)
if: ${{ matrix.libc }}
shell: bash
run: |
echo "SHORT_TARGET_NAME=${{ matrix.platform }}-${{ matrix.architecture }}-${{ matrix.libc }}" >> $GITHUB_ENV
echo "PRE_GYP_TARGET_NAME=${{ matrix.platform }}-${{ matrix.architecture }}-${{ matrix.libc }}" >> $GITHUB_ENV
- name: Configure artifact names (not libc)
if: ${{ ! matrix.libc }}
shell: bash
run: |
echo "SHORT_TARGET_NAME=${{ matrix.platform }}-${{ matrix.architecture }}" >> $GITHUB_ENV
echo "PRE_GYP_TARGET_NAME=${{ matrix.platform }}-${{ matrix.architecture }}-unknown" >> $GITHUB_ENV
- name: Build - Cargo
if: matrix.target != 'x86_64-unknown-linux-musl'
run: cargo build --release --features=telemetry --locked --target ${{ matrix.target }}
- name: Code sign bin (Windows)
if: startsWith(github.ref, 'refs/heads/main') && matrix.os == 'windows-latest'
run: |
$certificate_file_name = "${env:TEMP}\certificate.pfx"
$bytes_cert = [Convert]::FromBase64String('${{ secrets.WINDOWS_CODE_SIGNING_CERTIFICATE }}')
[IO.File]::WriteAllBytes(${certificate_file_name}, ${bytes_cert})
$signtool_path = ((Resolve-Path -Path "${env:ProgramFiles(x86)}/Windows Kits/10/bin/10*/x86").Path[-1]) + "/signtool.exe"
$bin_path = (Resolve-Path -Path "target/${{ matrix.target }}/release/clarinet.exe").Path
& ${signtool_path} sign `
/d "Clarinet is a clarity runtime packaged as a command line tool, designed to facilitate smart contract understanding, development, testing and deployment." `
/du "https://github.com/hirosystems/clarinet" `
/tr http://timestamp.digicert.com `
/td sha256 `
/fd sha256 `
-f "${certificate_file_name}" `
-p "${{ secrets.WINDOWS_CODE_SIGNING_PASSWORD }}" `
"${bin_path}"
- name: Build Installer (Windows)
if: matrix.os == 'windows-latest'
run: cargo wix -v --no-build --nocapture -p clarinet-cli
- name: Code sign installer (Windows)
if: startsWith(github.ref, 'refs/heads/main') && matrix.os == 'windows-latest'
run: |
$certificate_file_name = "${env:TEMP}\certificate.pfx"
$bytes_cert = [Convert]::FromBase64String('${{ secrets.WINDOWS_CODE_SIGNING_CERTIFICATE }}')
[IO.File]::WriteAllBytes(${certificate_file_name}, ${bytes_cert})
$signtool_path = ((Resolve-Path -Path "${env:ProgramFiles(x86)}/Windows Kits/10/bin/10*/x86").Path[-1]) + "/signtool.exe"
$msi_path = (Resolve-Path -Path "target/wix/*.msi").Path
& ${signtool_path} sign `
/d "Clarinet is a clarity runtime packaged as a command line tool, designed to facilitate smart contract understanding, development, testing and deployment." `
/du "https://github.com/hirosystems/clarinet" `
/tr http://timestamp.digicert.com `
/td sha256 `
/fd sha256 `
-f "${certificate_file_name}" `
-p "${{ secrets.WINDOWS_CODE_SIGNING_PASSWORD }}" `
"${msi_path}"
# Don't compress for Windows because winget can't yet unzip files
- name: Compress cargo artifact (Linux)
if: matrix.os != 'windows-latest'
run: tar -C target/${{ matrix.target }}/release -zcvf clarinet-${{ env.SHORT_TARGET_NAME }}.tar.gz clarinet
- name: Rename cargo artifact (Windows)
if: matrix.os == 'windows-latest'
shell: bash
run: mv target/wix/*.msi clarinet-${{ env.SHORT_TARGET_NAME }}.msi
# Separate uploads to prevent paths from being preserved
- name: Upload cargo artifacts (Linux)
if: matrix.os != 'windows-latest'
uses: actions/upload-artifact@v2
with:
name: clarinet-${{ env.SHORT_TARGET_NAME }}
path: clarinet-${{ env.SHORT_TARGET_NAME }}.tar.gz
- name: Upload cargo artifact (Windows)
if: matrix.os == 'windows-latest'
uses: actions/upload-artifact@v2
with:
name: clarinet-${{ env.SHORT_TARGET_NAME }}
path: clarinet-${{ env.SHORT_TARGET_NAME }}.msi
- name: Unit Tests - Cargo
# can't easily run mac-arm64 tests in GH without native runners for that arch
if: matrix.target != 'aarch64-apple-darwin'
run: cargo test --release --locked --target ${{ matrix.target }}
- name: Functional Tests (Linux)
# can't easily run mac-arm64 tests in GH without native runners for that arch
if: matrix.os != 'windows-latest' && matrix.target != 'aarch64-apple-darwin'
run: |
for testdir in $(ls components/clarinet-cli/examples); do
./target/${{ matrix.target }}/release/clarinet test --manifest-path components/clarinet-cli/examples/${testdir}/Clarinet.toml
done
- name: Functional Tests (Windows)
if: matrix.os == 'windows-latest'
run: |
foreach($testdir in Get-ChildItem components/clarinet-cli/examples) {
./target/${{ matrix.target }}/release/clarinet test --manifest-path ${testdir}/Clarinet.toml
}
dist_stacks_devnet_js:
name: Build Stacks Devnet JS Distributions
runs-on: ${{ matrix.os }}
needs:
- pre_run
- get_release_info
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
platform: linux
target: x86_64-unknown-linux-gnu
architecture: x64
libc: glibc
- os: windows-latest
platform: windows
target: x86_64-pc-windows-msvc
architecture: x64
- os: macos-latest
platform: darwin
target: x86_64-apple-darwin
architecture: x64
- os: macos-latest
platform: darwin
target: aarch64-apple-darwin
architecture: arm64
- os: ubuntu-latest
platform: linux
target: x86_64-unknown-linux-musl
architecture: x64
libc: musl
steps:
- name: Configure git to use LF (Windows)
if: matrix.os == 'windows-latest' && github.event_name != 'pull_request'
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Checkout repository
if: github.event_name != 'pull_request' || matrix.target == 'x86_64-unknown-linux-gnu'
uses: actions/checkout@v2
with:
submodules: recursive
- name: Install Rust toolchain
if: github.event_name != 'pull_request' || matrix.target == 'x86_64-unknown-linux-gnu'
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
profile: minimal
components: llvm-tools-preview
override: true
- name: Install and cache Node
if: github.event_name != 'pull_request' && matrix.target != 'x86_64-unknown-linux-musl'
uses: actions/setup-node@v3
with:
node-version: "14"
# Host nodejs arch does not matter in our usecase for compiling cross-platform npm packages,
# if enabled, this will fail after installing an arm64 nodejs runtime for an x86_64 arch macos system
# architecture: ${{ matrix.architecture }}
cache: npm
cache-dependency-path: components/stacks-devnet-js/package-lock.json
- name: Cache cargo
if: github.event_name != 'pull_request' || matrix.target == 'x86_64-unknown-linux-gnu'
uses: actions/cache@v2
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/${{ matrix.target }}/release/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
# Set environment variables required from cross compiling from macos-x86_64 to macos-arm64
- name: Configure macos-arm64 cross compile config
if: github.event_name != 'pull_request' && matrix.target == 'aarch64-apple-darwin'
run: |
echo "SDKROOT=$(xcrun -sdk macosx --show-sdk-path)" >> $GITHUB_ENV
echo "MACOSX_DEPLOYMENT_TARGET=$(xcrun -sdk macosx --show-sdk-platform-version)" >> $GITHUB_ENV
- name: Configure artifact names (libc)
if: (github.event_name != 'pull_request' || matrix.target == 'x86_64-unknown-linux-gnu') && matrix.libc
shell: bash
run: |
echo "SHORT_TARGET_NAME=${{ matrix.platform }}-${{ matrix.architecture }}-${{ matrix.libc }}" >> $GITHUB_ENV
echo "PRE_GYP_TARGET_NAME=${{ matrix.platform }}-${{ matrix.architecture }}-${{ matrix.libc }}" >> $GITHUB_ENV
- name: Configure artifact names (not libc)
if: github.event_name != 'pull_request' && ! matrix.libc
shell: bash
run: |
echo "SHORT_TARGET_NAME=${{ matrix.platform }}-${{ matrix.architecture }}" >> $GITHUB_ENV
echo "PRE_GYP_TARGET_NAME=${{ matrix.platform }}-${{ matrix.architecture }}-unknown" >> $GITHUB_ENV
- name: Build - Node
if: (github.event_name != 'pull_request' || matrix.target == 'x86_64-unknown-linux-gnu') && matrix.target != 'x86_64-unknown-linux-musl'
working-directory: components/stacks-devnet-js
run: |
npm install --ignore-scripts
npm run build-${{ env.SHORT_TARGET_NAME }}
- name: Build - Node (linux-musl)
if: github.event_name != 'pull_request' && matrix.target == 'x86_64-unknown-linux-musl'
uses: docker://rust:alpine3.15
env:
RUSTFLAGS: -C target-feature=-crt-static
with:
entrypoint: /bin/sh
args: -c "
cd components/stacks-devnet-js &&
apk add alpine-sdk nodejs npm git &&
npm install --ignore-scripts &&
npm run build-${{ env.SHORT_TARGET_NAME }}"
- name: Compress node artifact
if: github.event_name != 'pull_request' || matrix.target == 'x86_64-unknown-linux-gnu'
shell: bash
run: tar -C components/stacks-devnet-js -zcvf stacks-devnet-js-${{ env.PRE_GYP_TARGET_NAME }}.tar.gz native/index.node
- name: Upload node artifact
if: github.event_name != 'pull_request' || matrix.target == 'x86_64-unknown-linux-gnu'
uses: actions/upload-artifact@v2
with:
name: stacks-devnet-js-${{ env.PRE_GYP_TARGET_NAME }}
path: stacks-devnet-js-${{ env.PRE_GYP_TARGET_NAME }}.tar.gz
# - name: Unit Tests - Node
# working-directory: node-bindings
# run: npm run spec
- name: NPM Publish
uses: JS-DevTools/npm-publish@v1
if: matrix.target == 'x86_64-unknown-linux-gnu' && startsWith(github.ref, 'refs/heads/main') && needs.get_release_info.outputs.tag != ''
with:
package: components/stacks-devnet-js/package.json
access: public
greater-version-only: true
token: ${{ secrets.NPM_TOKEN }}
dist_clarity_repl:
name: Build Clarity REPL Distribution
runs-on: ubuntu-latest
needs: pre_run
defaults:
run:
working-directory: components/clarity-repl
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: recursive
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: x86_64-unknown-linux-gnu
profile: minimal
components: llvm-tools-preview
override: true
- name: Cache cargo
uses: actions/cache@v2
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/x86_64-unknown-linux-gnu/release/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Configure artifact names
run: |
echo "SHORT_TARGET_NAME=linux-x64-glibc" >> $GITHUB_ENV
echo "PRE_GYP_TARGET_NAME=linux-x64-glibc" >> $GITHUB_ENV
- name: Install dependencies
run: cargo install --force wasm-pack
- name: Build - Cargo
run: cargo build --release --locked --target x86_64-unknown-linux-gnu
# - name: Build - WASM
# run: wasm-pack build --target web --release -- --no-default-features --features wasm
- name: Compress cargo artifact
working-directory: "."
run: tar -C target/x86_64-unknown-linux-gnu/release -zcvf clarity-repl-${{ env.SHORT_TARGET_NAME }}.tar.gz clarity-repl
# - name: Compress wasm artifact
# working-directory: "."
# run: tar -C target/wasm32-unknown-unknown/release -zcvf clarity-repl-wasm.tar.gz clarity_repl.wasm
- name: Upload cargo artifact
uses: actions/upload-artifact@v2
with:
name: clarity-repl-${{ env.SHORT_TARGET_NAME }}
path: clarity-repl-${{ env.SHORT_TARGET_NAME }}.tar.gz
# - name: Upload wasm artifact
# uses: actions/upload-artifact@v2
# with:
# name: clarity-repl-wasm
# path: clarity-repl-wasm.tar.gz
- name: Unit Tests - Cargo
run: cargo test --release --locked --target x86_64-unknown-linux-gnu
- name: Publish clarity-repl to crates.io
if: startsWith(github.ref, 'refs/heads/main') && needs.get_release_info.outputs.tag != ''
run: |
cargo login ${{ secrets.CARGO_CRATES_IO_API_KEY }}
cargo publish
docker_images:
name: Create ${{ matrix.name }} Docker Image
runs-on: ubuntu-latest
needs:
- get_release_info
- dist_clarinet
outputs:
version: ${{ steps.docker_meta.outputs.version }}
strategy:
fail-fast: false
matrix:
include:
- name: Clarinet
description: Clarinet is a simple, modern and opinionated runtime for testing, integrating and deploying Clarity smart contracts.
image: ${{ github.repository }}
artifact: clarinet-linux-x64-glibc
dockerfile: dockerfiles/components/clarinet.dockerfile
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Generate Docker tags/labels
id: docker_meta
uses: docker/metadata-action@v4
with:
images: ${{ matrix.image }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}},value=${{ needs.get_release_info.outputs.tag }},enable=${{ needs.get_release_info.outputs.tag != '' }}
type=semver,pattern={{major}}.{{minor}},value=${{ needs.get_release_info.outputs.tag }},enable=${{ needs.get_release_info.outputs.tag != '' }}
labels: |
org.opencontainers.image.title=${{ matrix.name }}
org.opencontainers.image.description=${{ matrix.description }}
- name: Login to Dockerhub
uses: docker/login-action@v2
if: github.event_name != 'pull_request'
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Download pre-built dist
uses: actions/download-artifact@v3
with:
name: ${{ matrix.artifact }}
- name: Untar pre-built dist
run: tar zxvf *.tar.gz
- name: Create Image
uses: docker/build-push-action@v3
with:
context: .
file: ${{ matrix.dockerfile }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
release:
name: Release
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/heads/main') && needs.get_release_info.outputs.tag != ''
needs:
- get_release_info
- audit
# - test_coverage_cargo
- dist_stacks_devnet_js
- dist_clarity_repl
- docker_images
permissions:
actions: write
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Download pre-built dists
uses: actions/download-artifact@v3
- name: Tag and Release
uses: ncipollo/release-action@v1
with:
artifacts: "**/*.tar.gz,**/*.msi"
tag: ${{ needs.get_release_info.outputs.tag }}
commit: ${{ env.GITHUB_SHA }}
- name: Trigger pkg-version-bump workflow
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
event-type: released
client-payload: '{"tag": "${{ needs.get_release_info.outputs.tag }}"}'