1
- name : Publish NPM
1
+ name : npm
2
2
3
3
on :
4
4
workflow_dispatch :
@@ -22,6 +22,7 @@ defaults:
22
22
env :
23
23
ACTIONS_RUNNER_DEBUG : true
24
24
NPM_CONFIG_PROVENANCE : true
25
+ NPM_REGISTRY_URL : " https://registry.npmjs.org"
25
26
26
27
jobs :
27
28
publish-arch :
@@ -54,31 +55,38 @@ jobs:
54
55
}}
55
56
outputs :
56
57
RELEASE_VERSION : ${{ steps.release-version.outputs.RELEASE_VERSION }}
57
- env :
58
- NPM_REGISTRY_URL : " https://registry.npmjs.org"
59
58
steps :
60
59
- name : Checkout
61
60
uses : actions/checkout@v5
62
61
62
+ - name : Set Isolated Artifact Directory
63
+ id : set-artifact-dir
64
+ # Use RUNNER_TEMP env var to persist ARTIFACT_DIR across steps
65
+ run : echo "ARTIFACT_DIR=$RUNNER_TEMP/foundry_artifacts" >> "$GITHUB_ENV"
66
+
67
+ - name : Prepare Isolated Artifact Directory
68
+ run : |
69
+ mkdir -p "$ARTIFACT_DIR"
70
+ ls -la "$ARTIFACT_DIR" || true
71
+
63
72
- name : Download Release Assets
64
73
uses : actions/download-artifact@v5
65
74
with :
66
75
merge-multiple : true
67
76
# Download all foundry artifacts from the triggering release run
68
77
pattern : " foundry_*"
69
- path : foundry_artifacts
78
+ # Extract artifacts into an isolated temp directory, not the workspace
79
+ path : ${{ runner.temp }}/foundry_artifacts
70
80
github-token : ${{ secrets.GITHUB_TOKEN }}
71
81
run-id : ${{ github.event.workflow_run.id || inputs.run_id }}
72
82
73
83
- name : Setup Bun
74
- uses : oven-sh/setup-bun@main
84
+ uses : oven-sh/setup-bun@735343b667d3e6f658f44d0eca948eb6282f2b76 # v2.0.2
75
85
with :
76
86
bun-version : latest
77
- registries : |
78
- https://registry.npmjs.org
79
87
80
88
- name : Setup Node (for npm publish auth)
81
- uses : actions/setup-node@v4
89
+ uses : actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
82
90
with :
83
91
node-version : " 24"
84
92
registry-url : " https://registry.npmjs.org"
@@ -102,12 +110,12 @@ jobs:
102
110
run : |
103
111
set -euo pipefail
104
112
105
- echo "Artifacts in foundry_artifacts :"
106
- ls -la ../foundry_artifacts || true
113
+ echo "Artifacts in $ARTIFACT_DIR :"
114
+ ls -la "$ARTIFACT_DIR" || true
107
115
108
116
# Derive RELEASE_VERSION from any foundry artifact we downloaded
109
117
# Expected names: foundry_<VERSION>_<platform>_<arch>.{tar.gz,zip}
110
- first_file=$(ls ../foundry_artifacts /foundry_* 2>/dev/null | head -n1 || true)
118
+ first_file=$(ls "$ARTIFACT_DIR" /foundry_* 2>/dev/null | head -n1 || true)
111
119
if [[ -z "${first_file}" ]]; then
112
120
echo "No foundry artifacts found to publish" >&2
113
121
exit 1
@@ -125,20 +133,20 @@ jobs:
125
133
RELEASE_VERSION : ${{ steps.release-version.outputs.RELEASE_VERSION }}
126
134
run : |
127
135
set -euo pipefail
128
- mkdir -p tmp
136
+ mkdir -p "$ARTIFACT_DIR/ tmp"
129
137
130
- FILE_PREFIX="../foundry_artifacts /foundry_${RELEASE_VERSION}_${{ matrix.os }}_${{ matrix.arch }}"
138
+ FILE_PREFIX="$ARTIFACT_DIR /foundry_${RELEASE_VERSION}_${{ matrix.os }}_${{ matrix.arch }}"
131
139
if [[ -f "${FILE_PREFIX}.zip" ]]; then
132
140
echo "Extracting ${FILE_PREFIX}.zip"
133
141
if ! command -v unzip >/dev/null 2>&1; then
134
142
sudo apt-get update -y && sudo apt-get install -y unzip
135
143
fi
136
- unzip -o "${FILE_PREFIX}.zip" -d . /tmp
137
- BIN=. /tmp/forge.exe
144
+ unzip -o "${FILE_PREFIX}.zip" -d "$ARTIFACT_DIR /tmp"
145
+ BIN="$ARTIFACT_DIR /tmp/forge.exe"
138
146
else
139
147
echo "Extracting ${FILE_PREFIX}.tar.gz"
140
- tar -xzf "${FILE_PREFIX}.tar.gz" -C . /tmp
141
- BIN=. /tmp/forge
148
+ tar -xzf "${FILE_PREFIX}.tar.gz" -C "$ARTIFACT_DIR /tmp"
149
+ BIN="$ARTIFACT_DIR /tmp/forge"
142
150
fi
143
151
144
152
echo "Staging binary $BIN into @foundry-rs/forge-${{ matrix.os }}-${{ matrix.arch }}"
@@ -193,23 +201,20 @@ jobs:
193
201
name : Publish Meta Package
194
202
runs-on : ubuntu-latest
195
203
env :
196
- RELEASE_VERSION : ${{ needs.publish-arch.outputs.RELEASE_VERSION }}
197
204
NPM_TOKEN : ${{ secrets.NPM_TOKEN }}
198
205
NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
199
- NPM_REGISTRY_URL : " https://registry.npmjs.org "
206
+ RELEASE_VERSION : ${{ needs.publish-arch.outputs.RELEASE_VERSION }}
200
207
steps :
201
208
- name : Checkout
202
209
uses : actions/checkout@v5
203
210
204
211
- name : Setup Bun
205
- uses : oven-sh/setup-bun@main
212
+ uses : oven-sh/setup-bun@735343b667d3e6f658f44d0eca948eb6282f2b76 # v2.0.2
206
213
with :
207
214
bun-version : latest
208
- registries : |
209
- https://registry.npmjs.org
210
215
211
216
- name : Setup Node (for npm publish auth)
212
- uses : actions/setup-node@v4
217
+ uses : actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
213
218
with :
214
219
node-version : " 24"
215
220
registry-url : " https://registry.npmjs.org"
0 commit comments