Skip to content

Commit 504a166

Browse files
committed
ci: auto release switchboard tags
1 parent d8b58bc commit 504a166

1 file changed

Lines changed: 30 additions & 17 deletions

File tree

.github/workflows/plugin-release.yml

Lines changed: 30 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
name: Plugin Release
22

33
on:
4+
push:
5+
tags:
6+
- "v*"
47
workflow_dispatch:
58
inputs:
69
release_tag:
@@ -28,25 +31,16 @@ jobs:
2831
HF_ADMIN_TOKEN: ${{ secrets.HF_ADMIN_TOKEN }}
2932

3033
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-
4534
- name: Validate release inputs
4635
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 }}
4740
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()
5044
5145
if ([string]::IsNullOrWhiteSpace($tag)) {
5246
throw "release_tag is required."
@@ -60,9 +54,28 @@ jobs:
6054
if ([string]::IsNullOrWhiteSpace($title)) {
6155
$title = "Switchboard $tag"
6256
}
57+
if ([string]::IsNullOrWhiteSpace($source)) {
58+
$source = "official"
59+
}
6360
6461
"RELEASE_TAG=$tag" | Out-File -FilePath $env:GITHUB_ENV -Append
6562
"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
6679

6780
- name: Package .hfpkg
6881
shell: pwsh
@@ -128,7 +141,7 @@ jobs:
128141
"--yes", "@haloforge/plugin-pack@0.2.13",
129142
"metadata", "$env:PKG_PATH",
130143
"--artifact-url", $artifactUrl,
131-
"--source", "${{ inputs.source }}",
144+
"--source", "$env:RELEASE_SOURCE",
132145
"--homepage-url", "https://haloforge.dev/catalog/plugins/switchboard",
133146
"--repository-url", "https://github.com/${{ github.repository }}",
134147
"--pretty",

0 commit comments

Comments
 (0)