|
1 | 1 | name: Plugin Release |
2 | 2 |
|
3 | 3 | on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - "v*" |
4 | 7 | workflow_dispatch: |
5 | 8 | inputs: |
6 | 9 | release_tag: |
@@ -28,25 +31,16 @@ jobs: |
28 | 31 | HF_ADMIN_TOKEN: ${{ secrets.HF_ADMIN_TOKEN }} |
29 | 32 |
|
30 | 33 | steps: |
31 | | - - uses: actions/checkout@v4 |
32 | | - with: |
33 | | - fetch-depth: 0 |
34 | | - |
35 | | - - name: Setup Node.js |
36 | | - uses: actions/setup-node@v4 |
37 | | - with: |
38 | | - node-version: 20 |
39 | | - |
40 | | - - name: Setup Rust |
41 | | - uses: dtolnay/rust-toolchain@stable |
42 | | - with: |
43 | | - targets: x86_64-pc-windows-msvc |
44 | | - |
45 | 34 | - name: Validate release inputs |
46 | 35 | shell: pwsh |
| 36 | + env: |
| 37 | + RELEASE_TAG_INPUT: ${{ github.event_name == 'push' && github.ref_name || inputs.release_tag }} |
| 38 | + RELEASE_TITLE_INPUT: ${{ inputs.release_name }} |
| 39 | + RELEASE_SOURCE_INPUT: ${{ github.event_name == 'push' && 'official' || inputs.source }} |
47 | 40 | run: | |
48 | | - $tag = "${{ inputs.release_tag }}".Trim() |
49 | | - $title = "${{ inputs.release_name }}".Trim() |
| 41 | + $tag = ([string]$env:RELEASE_TAG_INPUT).Trim() |
| 42 | + $title = ([string]$env:RELEASE_TITLE_INPUT).Trim() |
| 43 | + $source = ([string]$env:RELEASE_SOURCE_INPUT).Trim() |
50 | 44 |
|
51 | 45 | if ([string]::IsNullOrWhiteSpace($tag)) { |
52 | 46 | throw "release_tag is required." |
|
60 | 54 | if ([string]::IsNullOrWhiteSpace($title)) { |
61 | 55 | $title = "Switchboard $tag" |
62 | 56 | } |
| 57 | + if ([string]::IsNullOrWhiteSpace($source)) { |
| 58 | + $source = "official" |
| 59 | + } |
63 | 60 |
|
64 | 61 | "RELEASE_TAG=$tag" | Out-File -FilePath $env:GITHUB_ENV -Append |
65 | 62 | "RELEASE_TITLE=$title" | Out-File -FilePath $env:GITHUB_ENV -Append |
| 63 | + "RELEASE_SOURCE=$source" | Out-File -FilePath $env:GITHUB_ENV -Append |
| 64 | +
|
| 65 | + - uses: actions/checkout@v4 |
| 66 | + with: |
| 67 | + fetch-depth: 0 |
| 68 | + ref: ${{ github.event_name == 'push' && github.ref || inputs.release_tag }} |
| 69 | + |
| 70 | + - name: Setup Node.js |
| 71 | + uses: actions/setup-node@v4 |
| 72 | + with: |
| 73 | + node-version: 20 |
| 74 | + |
| 75 | + - name: Setup Rust |
| 76 | + uses: dtolnay/rust-toolchain@stable |
| 77 | + with: |
| 78 | + targets: x86_64-pc-windows-msvc |
66 | 79 |
|
67 | 80 | - name: Package .hfpkg |
68 | 81 | shell: pwsh |
@@ -128,7 +141,7 @@ jobs: |
128 | 141 | "--yes", "@haloforge/plugin-pack@0.2.13", |
129 | 142 | "metadata", "$env:PKG_PATH", |
130 | 143 | "--artifact-url", $artifactUrl, |
131 | | - "--source", "${{ inputs.source }}", |
| 144 | + "--source", "$env:RELEASE_SOURCE", |
132 | 145 | "--homepage-url", "https://haloforge.dev/catalog/plugins/switchboard", |
133 | 146 | "--repository-url", "https://github.com/${{ github.repository }}", |
134 | 147 | "--pretty", |
|
0 commit comments