Skip to content

Commit 3aee569

Browse files
committed
run on test tag creation
1 parent 4a1fac9 commit 3aee569

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

.github/workflows/rust-release.yml

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,15 @@ on:
1010
push:
1111
tags:
1212
- "rust-v*.*.*"
13-
workflow_dispatch:
14-
inputs:
15-
release_tag:
16-
description: Release tag to publish to WinGet
17-
required: true
18-
type: string
13+
- "winget-test-rust-v*"
1914

2015
concurrency:
2116
group: ${{ github.workflow }}
2217
cancel-in-progress: true
2318

2419
jobs:
2520
tag-check:
26-
if: ${{ github.event_name == 'push' }}
21+
if: ${{ github.event_name == 'push' && startsWith(github.ref_name, 'rust-v') }}
2722
runs-on: ubuntu-latest
2823
steps:
2924
- uses: actions/checkout@v6
@@ -53,7 +48,7 @@ jobs:
5348
echo "::endgroup::"
5449
5550
build:
56-
if: ${{ github.event_name == 'push' }}
51+
if: ${{ github.event_name == 'push' && startsWith(github.ref_name, 'rust-v') }}
5752
needs: tag-check
5853
name: Build - ${{ matrix.runner }} - ${{ matrix.target }}
5954
runs-on: ${{ matrix.runs_on || matrix.runner }}
@@ -370,15 +365,15 @@ jobs:
370365
codex-rs/dist/${{ matrix.target }}/*
371366
372367
build-windows:
373-
if: ${{ github.event_name == 'push' }}
368+
if: ${{ github.event_name == 'push' && startsWith(github.ref_name, 'rust-v') }}
374369
needs: tag-check
375370
uses: ./.github/workflows/rust-release-windows.yml
376371
with:
377372
release-lto: ${{ contains(github.ref_name, '-alpha') && 'thin' || 'fat' }}
378373
secrets: inherit
379374

380375
shell-tool-mcp:
381-
if: ${{ github.event_name == 'push' }}
376+
if: ${{ github.event_name == 'push' && startsWith(github.ref_name, 'rust-v') }}
382377
name: shell-tool-mcp
383378
needs: tag-check
384379
uses: ./.github/workflows/shell-tool-mcp.yml
@@ -388,7 +383,7 @@ jobs:
388383
secrets: inherit
389384

390385
release:
391-
if: ${{ github.event_name == 'push' }}
386+
if: ${{ github.event_name == 'push' && startsWith(github.ref_name, 'rust-v') }}
392387
needs:
393388
- build
394389
- build-windows
@@ -540,7 +535,7 @@ jobs:
540535
# July 31, 2025: https://github.blog/changelog/2025-07-31-npm-trusted-publishing-with-oidc-is-generally-available/
541536
# npm docs: https://docs.npmjs.com/trusted-publishers
542537
publish-npm:
543-
if: ${{ github.event_name == 'push' && needs.release.outputs.should_publish_npm == 'true' }}
538+
if: ${{ github.event_name == 'push' && startsWith(github.ref_name, 'rust-v') && needs.release.outputs.should_publish_npm == 'true' }}
544539
name: publish-npm
545540
needs: release
546541
runs-on: ubuntu-latest
@@ -646,7 +641,7 @@ jobs:
646641
done
647642
648643
update-branch:
649-
if: ${{ github.event_name == 'push' }}
644+
if: ${{ github.event_name == 'push' && startsWith(github.ref_name, 'rust-v') }}
650645
name: Update latest-alpha-cli branch
651646
permissions:
652647
contents: write
@@ -666,7 +661,7 @@ jobs:
666661
-F force=true
667662
668663
winget-test:
669-
if: ${{ github.event_name == 'workflow_dispatch' }}
664+
if: ${{ github.event_name == 'push' && startsWith(github.ref_name, 'winget-test-rust-v') }}
670665
name: winget-test
671666
runs-on: ubuntu-latest
672667
permissions:
@@ -678,21 +673,22 @@ jobs:
678673
run: |
679674
set -euo pipefail
680675
681-
release_tag="${{ inputs.release_tag }}"
676+
release_tag="${GITHUB_REF_NAME#winget-test-}"
682677
if [[ ! "${release_tag}" =~ ^rust-v[0-9]+\.[0-9]+\.[0-9]+(-(alpha|beta)(\.[0-9]+)?)?$ ]]; then
683678
echo "Invalid release tag: ${release_tag}"
684679
exit 1
685680
fi
686681
687682
version="${release_tag#rust-v}"
683+
echo "release_tag=${release_tag}" >> "$GITHUB_OUTPUT"
688684
echo "version=${version}" >> "$GITHUB_OUTPUT"
689685
690686
- name: Publish to WinGet via winget-releaser
691687
uses: vedantmgoyal9/winget-releaser@19e706d4c9121098010096f9c495a70a7518b30f
692688
with:
693689
identifier: OpenAI.Codex
694690
version: ${{ steps.vars.outputs.version }}
695-
release-tag: ${{ inputs.release_tag }}
691+
release-tag: ${{ steps.vars.outputs.release_tag }}
696692
fork-user: openai-oss-forks
697693
installers-regex: '^codex-(?:x86_64|aarch64)-pc-windows-msvc\.exe\.zip$'
698694
token: ${{ secrets.WINGET_PUBLISH_PAT }}

0 commit comments

Comments
 (0)