Skip to content

Commit 9f60e87

Browse files
committed
ci: make release conditional on being on the root (non-fork) repo
1 parent ca815ab commit 9f60e87

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868
rustup --version
6969
rustup toolchain install
7070
- name: download singular
71-
if: matrix.features == 'singular'
71+
if: ${{ matrix.features == 'singular' }}
7272
run: |
7373
curl -LO https://www.singular.uni-kl.de/ftp/pub/Math/Singular/UNIX/Singular-4-3-2_M1.dmg
7474
- name: build and test
@@ -121,7 +121,7 @@ jobs:
121121
run: |
122122
cargo build
123123
- name: build verus release
124-
if: matrix.features == ''
124+
if: ${{ matrix.features == '' }}
125125
working-directory: ./source
126126
run: |
127127
. "$HOME/.cargo/env"
@@ -132,26 +132,26 @@ jobs:
132132
cp -R ./target-verus/release ../verus-arm64-macos
133133
cd ..; zip -r verus-arm64-macos.zip ./verus-arm64-macos
134134
- name: run verus release
135-
if: matrix.features == ''
135+
if: ${{ matrix.features == '' }}
136136
working-directory: ./source
137137
run: |
138138
ls -Al ./target-verus/release
139139
./target-verus/release/verus ../examples/test.rs
140140
- name: upload verus release artifact
141141
uses: actions/upload-artifact@v4
142-
if: matrix.features == ''
142+
if: ${{ matrix.features == '' && github.repository == 'verus-lang/verus' }}
143143
with:
144144
name: verus-arm64-macos
145145
path: verus-arm64-macos.zip
146146
- name: build docs
147-
if: matrix.features == ''
147+
if: ${{ matrix.features == '' }}
148148
working-directory: ./source
149149
run: |
150150
. "$HOME/.cargo/env"
151151
./tools/docs.sh
152152
- name: upload verusdoc artifact
153153
uses: actions/upload-artifact@v4
154-
if: matrix.features == ''
154+
if: ${{ matrix.features == '' && github.repository == 'verus-lang/verus' }}
155155
with:
156156
name: verusdoc
157157
path: source/doc
@@ -201,6 +201,7 @@ jobs:
201201
./target-verus/release/verus ../examples/test.rs
202202
- name: upload verus release artifact
203203
uses: actions/upload-artifact@v4
204+
if: ${{ github.repository == 'verus-lang/verus' }}
204205
with:
205206
name: verus-x86-macos
206207
path: verus-x86-macos.zip
@@ -245,6 +246,7 @@ jobs:
245246
shell: powershell
246247
- name: upload verus release artifact
247248
uses: actions/upload-artifact@v4
249+
if: ${{ github.repository == 'verus-lang/verus' }}
248250
with:
249251
name: verus-x86-win
250252
path: verus-x86-win.zip
@@ -289,6 +291,7 @@ jobs:
289291
./target-verus/release/verus ../examples/test.rs
290292
- name: upload verus release artifact
291293
uses: actions/upload-artifact@v4
294+
if: ${{ github.repository == 'verus-lang/verus' }}
292295
with:
293296
name: verus-x86-linux
294297
path: verus-x86-linux.zip
@@ -318,7 +321,7 @@ jobs:
318321
319322
release:
320323
needs: [fmt, smoke-test-and-release-linux, smoke-test-and-release-windows, test-and-release-macos, smoke-test-and-release-macos-x86, docs]
321-
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
324+
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository == 'verus-lang/verus' }}
322325
runs-on: ubuntu-latest
323326
steps:
324327
- name: download all artifacts

.github/workflows/release.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ permissions:
1111
jobs:
1212
copy-release:
1313
runs-on: ubuntu-latest
14+
if: ${{ github.repository == 'verus-lang/verus' }}
1415

1516
steps:
1617
- name: Get Release Info
@@ -38,7 +39,7 @@ jobs:
3839
run: |
3940
new_release_tag=$(echo $release_tag | sed 's/\/rolling//')
4041
new_release_name=$(echo $release_name | sed 's/Rolling //')
41-
42+
4243
response=$(curl -s -X POST -H "Authorization: token $GITHUB_TOKEN" \
4344
-H "Content-Type: application/json" \
4445
-d "{\"tag_name\": \"$new_release_tag\", \"name\": \"$new_release_name\", \"body\": \"$release_tag\"}" \
@@ -54,12 +55,12 @@ jobs:
5455
new_release_id: ${{ env.new_release_id }}
5556
run: |
5657
assets=$(echo $release_assets | jq -c '.[]')
57-
58+
5859
for asset in $assets; do
5960
asset_url=$(echo $asset | jq -r '.url')
6061
asset_name=$(echo $asset | jq -r '.name')
6162
asset_download_url=$(curl -s -H "Authorization: token $GITHUB_TOKEN" $asset_url | jq -r '.browser_download_url')
62-
63+
6364
curl -L -o $asset_name -H "Authorization: token $GITHUB_TOKEN" $asset_download_url
6465
curl -X POST -H "Authorization: token $GITHUB_TOKEN" \
6566
-H "Content-Type: application/octet-stream" \

0 commit comments

Comments
 (0)