Skip to content

Commit f9231e9

Browse files
committed
fix release workflow
1 parent 53725b8 commit f9231e9

File tree

6 files changed

+64
-27
lines changed

6 files changed

+64
-27
lines changed

.github/workflows/release.yml

Lines changed: 48 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This file was autogenerated by dist: https://opensource.axo.dev/cargo-dist/
1+
# This file was autogenerated by dist: https://axodotdev.github.io/cargo-dist
22
#
33
# Copyright 2022-2024, axodotdev
44
# SPDX-License-Identifier: MIT or Apache-2.0
@@ -47,23 +47,24 @@ on:
4747
jobs:
4848
# Run 'dist plan' (or host) to determine what tasks we need to do
4949
plan:
50-
runs-on: "ubuntu-20.04"
50+
runs-on: "ubuntu-22.04"
5151
outputs:
5252
val: ${{ steps.plan.outputs.manifest }}
5353
tag: ${{ !github.event.pull_request && github.ref_name || '' }}
5454
tag-flag: ${{ !github.event.pull_request && format('--tag={0}', github.ref_name) || '' }}
5555
publishing: ${{ !github.event.pull_request }}
5656
env:
57-
GH_TOKEN: ${{ secrets.GH_PAT }}
57+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5858
steps:
5959
- uses: actions/checkout@v4
6060
with:
61+
persist-credentials: false
6162
submodules: recursive
6263
- name: Install dist
6364
# we specify bash to get pipefail; it guards against the `curl` command
6465
# failing. otherwise `sh` won't catch that `curl` returned non-0
6566
shell: bash
66-
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.28.0/cargo-dist-installer.sh | sh"
67+
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.30.2/cargo-dist-installer.sh | sh"
6768
- name: Cache dist
6869
uses: actions/upload-artifact@v4
6970
with:
@@ -109,14 +110,15 @@ jobs:
109110
runs-on: ${{ matrix.runner }}
110111
container: ${{ matrix.container && matrix.container.image || null }}
111112
env:
112-
GH_TOKEN: ${{ secrets.GH_PAT }}
113+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
113114
BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json
114115
steps:
115116
- name: enable windows longpaths
116117
run: |
117118
git config --global core.longpaths true
118119
- uses: actions/checkout@v4
119120
with:
121+
persist-credentials: false
120122
submodules: recursive
121123
- name: Install Rust non-interactively if not already installed
122124
if: ${{ matrix.container }}
@@ -168,13 +170,14 @@ jobs:
168170
needs:
169171
- plan
170172
- build-local-artifacts
171-
runs-on: "ubuntu-20.04"
173+
runs-on: "ubuntu-22.04"
172174
env:
173-
GH_TOKEN: ${{ secrets.GH_PAT }}
175+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
174176
BUILD_MANIFEST_NAME: target/distrib/global-dist-manifest.json
175177
steps:
176178
- uses: actions/checkout@v4
177179
with:
180+
persist-credentials: false
178181
submodules: recursive
179182
- name: Install cached dist
180183
uses: actions/download-artifact@v4
@@ -214,16 +217,17 @@ jobs:
214217
- plan
215218
- build-local-artifacts
216219
- build-global-artifacts
217-
# Only run if we're "publishing", and only if local and global didn't fail (skipped is fine)
218-
if: ${{ always() && needs.plan.outputs.publishing == 'true' && (needs.build-global-artifacts.result == 'skipped' || needs.build-global-artifacts.result == 'success') && (needs.build-local-artifacts.result == 'skipped' || needs.build-local-artifacts.result == 'success') }}
220+
# Only run if we're "publishing", and only if plan, local and global didn't fail (skipped is fine)
221+
if: ${{ always() && needs.plan.result == 'success' && needs.plan.outputs.publishing == 'true' && (needs.build-global-artifacts.result == 'skipped' || needs.build-global-artifacts.result == 'success') && (needs.build-local-artifacts.result == 'skipped' || needs.build-local-artifacts.result == 'success') }}
219222
env:
220-
GH_TOKEN: ${{ secrets.GH_PAT }}
221-
runs-on: "ubuntu-20.04"
223+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
224+
runs-on: "ubuntu-22.04"
222225
outputs:
223226
val: ${{ steps.host.outputs.manifest }}
224227
steps:
225228
- uses: actions/checkout@v4
226229
with:
230+
persist-credentials: false
227231
submodules: recursive
228232
- name: Install cached dist
229233
uses: actions/download-artifact@v4
@@ -274,18 +278,48 @@ jobs:
274278
275279
gh release create "${{ needs.plan.outputs.tag }}" --target "$RELEASE_COMMIT" $PRERELEASE_FLAG --title "$ANNOUNCEMENT_TITLE" --notes-file "$RUNNER_TEMP/notes.txt" artifacts/*
276280
281+
publish-npm:
282+
needs:
283+
- plan
284+
- host
285+
runs-on: "ubuntu-22.04"
286+
env:
287+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
288+
PLAN: ${{ needs.plan.outputs.val }}
289+
if: ${{ !fromJson(needs.plan.outputs.val).announcement_is_prerelease || fromJson(needs.plan.outputs.val).publish_prereleases }}
290+
steps:
291+
- name: Fetch npm packages
292+
uses: actions/download-artifact@v4
293+
with:
294+
pattern: artifacts-*
295+
path: npm/
296+
merge-multiple: true
297+
- uses: actions/setup-node@v4
298+
with:
299+
node-version: '20.x'
300+
registry-url: 'https://registry.npmjs.org'
301+
- run: |
302+
for release in $(echo "$PLAN" | jq --compact-output '.releases[] | select([.artifacts[] | endswith("-npm-package.tar.gz")] | any)'); do
303+
pkg=$(echo "$release" | jq '.artifacts[] | select(endswith("-npm-package.tar.gz"))' --raw-output)
304+
npm publish --access public "./npm/${pkg}"
305+
done
306+
env:
307+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
308+
277309
announce:
278310
needs:
279311
- plan
280312
- host
313+
- publish-npm
281314
# use "always() && ..." to allow us to wait for all publish jobs while
282315
# still allowing individual publish jobs to skip themselves (for prereleases).
283316
# "host" however must run to completion, no skipping allowed!
284-
if: ${{ always() && needs.host.result == 'success' }}
285-
runs-on: "ubuntu-20.04"
317+
if: ${{ always() && needs.host.result == 'success' && (needs.publish-npm.result == 'skipped' || needs.publish-npm.result == 'success') }}
318+
runs-on: "ubuntu-22.04"
286319
env:
287-
GH_TOKEN: ${{ secrets.GH_PAT }}
320+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
288321
steps:
289322
- uses: actions/checkout@v4
290323
with:
324+
persist-credentials: false
291325
submodules: recursive

Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
[package]
22
name = "muton"
33
version = "1.0.0"
4-
edition = "2024"
4+
description = "Mutation testing framework for TON smart contracts"
55
repository = "https://github.com/trailofbits/muton"
6+
homepage = "https://github.com/trailofbits/muton"
7+
edition = "2024"
68

79
[[bin]]
810
name = "muton"

dist-workspace.toml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,18 @@ members = ["cargo:."]
44
# Config for 'dist'
55
[dist]
66
# The preferred dist version to use in CI (Cargo.toml SemVer syntax)
7-
cargo-dist-version = "0.28.0"
7+
cargo-dist-version = "0.30.2"
88
# CI backends to support
99
ci = "github"
1010
# The installers to generate for each app
1111
installers = ["shell", "npm"]
1212
# Target platforms to build apps for (Rust target-triple syntax)
13-
targets = ["aarch64-apple-darwin", "aarch64-unknown-linux-gnu", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu", "x86_64-pc-windows-msvc"]
14-
# A namespace to use when publishing this package to the npm registry
15-
npm-scope = "@trailofbits"
13+
targets = ["aarch64-apple-darwin", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu", "x86_64-pc-windows-msvc"]
1614
# Path that installers should place binaries in
1715
install-path = "CARGO_HOME"
1816
# Whether to install an updater program
1917
install-updater = false
18+
# A namespace to use when publishing this package to the npm registry
19+
npm-scope = "@trailofbits"
20+
# Publish jobs to run in CI
21+
publish-jobs = ["npm"]

flake.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@
134134

135135
devInputs = with pkgs; [
136136
cargo-watch
137-
cargo-dist
137+
# cargo-dist
138138
libiconv
139139
openssl
140140
pkg-config
@@ -152,6 +152,7 @@
152152
buildInputs = devInputs;
153153
shellHook = ''
154154
export CARGO_HOME=$(pwd)/.cargo
155+
export PATH="$CARGO_HOME/bin:$PATH"
155156
export DATABASE_URL="sqlite:muton.sqlite"
156157
'';
157158
};

justfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,6 @@ install-nix: build-nix
8383
uninstall-nix:
8484
nix profile remove muton
8585

86-
reinstall-nix: uninstall
86+
reinstall-nix: uninstall-nix
8787
just install
8888

src/types/config.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,10 @@ pub fn config() -> &'static GlobalConfig {
9999
CONFIG.get_or_init(|| {
100100
let mut cfg = default_global_config();
101101
// Apply nearest config file found by walking up from cwd, then env
102-
if let Some(path) = find_nearest_config_file() {
103-
if let Some(file_cfg) = read_config_file(&path) {
102+
if let Some(path) = find_nearest_config_file()
103+
&& let Some(file_cfg) = read_config_file(&path) {
104104
apply_file_config(&mut cfg, &file_cfg);
105105
}
106-
}
107106
apply_env_overrides(&mut cfg);
108107
cfg
109108
})
@@ -113,11 +112,10 @@ pub fn init_with_overrides(overrides: &CliOverrides) {
113112
let mut cfg = default_global_config();
114113

115114
// 1) Config file: walk up from cwd and use the first muton.toml found
116-
if let Some(path) = find_nearest_config_file() {
117-
if let Some(file_cfg) = read_config_file(&path) {
115+
if let Some(path) = find_nearest_config_file()
116+
&& let Some(file_cfg) = read_config_file(&path) {
118117
apply_file_config(&mut cfg, &file_cfg);
119118
}
120-
}
121119

122120
// 2) Environment variables
123121
apply_env_overrides(&mut cfg);

0 commit comments

Comments
 (0)