Skip to content

Commit 9e2b70d

Browse files
author
Hudson Xing
committed
feat: add release workflow to main
1 parent 1f00632 commit 9e2b70d

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

.github/workflows/release.yml

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ on:
99
description: 'The release version (e.g., v1.8.0). This will be used to create the Git tag.'
1010
required: true
1111
type: string
12+
# This input allows you to specify which branch to create the release from.
13+
source_branch:
14+
description: 'The branch to find the latest successful build artifact on.'
15+
required: true
16+
type: string
17+
# We default to 'main' to make the most common case easy.
18+
default: 'main'
1219

1320
jobs:
1421
# The job for creating a release
@@ -27,34 +34,32 @@ jobs:
2734
uses: actions/checkout@v4
2835

2936
# Step 2: Download the build artifact from your 'Build' workflow.
30-
# This finds the latest successful run on the 'main' branch and downloads the artifact.
31-
# This is the key step to avoid rebuilding from scratch.
37+
# This finds the latest successful run on the specified branch and downloads the artifact.
3238
- name: Download artifact from build workflow
3339
uses: dawidd6/action-download-artifact@v6
3440
with:
3541
# IMPORTANT: This must match the 'name:' field in your build.yaml file.
3642
workflow: Build
37-
# The branch where the successful workflow ran.
38-
branch: main
43+
# Use the branch from the manual input instead of hardcoding 'main'.
44+
branch: ${{ github.event.inputs.source_branch }}
3945
# We use a wildcard (*) because the artifact name from the build workflow
40-
# contains a dynamic commit SHA (e.g., vscode-reh-web-linux-x64-0.0.0-dev-70c943b).
46+
# contains a dynamic commit SHA (e.g., vscode-reh-web-linux-x64-0.0.0-dev-...).
4147
name: vscode-reh-web-linux-x64-*
4248
# The path where the downloaded artifact will be saved.
4349
path: ./release-assets
4450
# Ensure we only get the artifact from a successful run.
4551
workflow_conclusion: success
4652

4753
# Step 3: Prepare the release assets by renaming the artifact.
48-
# This takes the downloaded file (with a "dev" name) and gives it a clean,
49-
# official versioned name for the release. This is the name conda-forge will use.
54+
# This takes the downloaded file and gives it a clean, versioned name.
5055
- name: Prepare release assets
5156
id: prepare_assets
5257
run: |
5358
# Find the downloaded tarball (there should only be one).
5459
ARTIFACT_FILE=$(find ./release-assets -name "*.tar.gz")
5560
5661
if [ -z "$ARTIFACT_FILE" ]; then
57-
echo "::error::Build artifact not found in ./release-assets! Make sure the 'Build' workflow ran successfully on the main branch."
62+
echo "::error::Build artifact not found in ./release-assets! Make sure the 'Build' workflow ran successfully on the '${{ github.event.inputs.source_branch }}' branch."
5863
exit 1
5964
fi
6065
@@ -87,4 +92,5 @@ jobs:
8792
# Set to 'false' to publish immediately, or 'true' to create a draft.
8893
draft: false
8994
# Automatically generate release notes from commits since the last release.
90-
generate_release_notes: true
95+
generate_release_notes: true
96+

0 commit comments

Comments
 (0)