Skip to content

Commit 2dfae9d

Browse files
authored
Update release.yml
Signed-off-by: Hudson Xing <77495133+harvenstar@users.noreply.github.com>
1 parent d74057d commit 2dfae9d

File tree

1 file changed

+7
-41
lines changed

1 file changed

+7
-41
lines changed

.github/workflows/release.yml

Lines changed: 7 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,33 @@
1-
# Workflow name
21
name: Release
32

4-
# This workflow is triggered manually from the GitHub Actions tab test.
53
on:
64
workflow_dispatch:
75
inputs:
86
version:
97
description: 'The release version (e.g., v1.8.0). This will be used to create the Git tag.'
108
required: true
119
type: string
12-
# This input allows you to specify which branch to create the release from.
1310
source_branch:
1411
description: 'The branch to find the latest successful build artifact on.'
1512
required: true
1613
type: string
17-
# We default to 'main' to make the most common case easy.
1814
default: 'main'
1915

2016
jobs:
21-
# The job for creating a release
2217
create-release:
2318
name: Create Release
2419
runs-on: ubuntu-latest
2520
timeout-minutes: 30
2621
permissions:
27-
# This permission is required for creating a release and uploading assets.
2822
contents: write
2923

3024
steps:
31-
# Step 1: Check out the repository code.
32-
# This is necessary for the release action to create a Git tag in your repository.
25+
# Step 1: Checkout repository code
3326
- name: Checkout code
3427
uses: actions/checkout@v4
3528

29+
# Step 2: Delete existing tag if it exists, so the new tag is created with the release time
30+
# This ensures that the tag time and release time are always consistent
3631
- name: Delete existing tag (if any)
3732
uses: actions/github-script@v7
3833
with:
@@ -49,70 +44,41 @@ jobs:
4944
console.log(`Tag ${tag} does not exist or already deleted.`);
5045
}
5146
52-
# Step 2: Download the build artifact from your 'Build' workflow.
53-
# This finds the latest successful run on the specified branch and downloads the artifact.
47+
# Step 3: Download the build artifact produced by your build workflow
5448
- name: Download artifact from build workflow
5549
uses: dawidd6/action-download-artifact@v6
5650
with:
57-
# IMPORTANT: This must match the 'name:' field in your build.yaml file.
5851
workflow: build.yml
59-
# Use the branch from the manual input instead of hardcoding 'main'.
6052
branch: ${{ github.event.inputs.source_branch }}
61-
62-
# Tell the action to look for artifacts created by a 'pull_request' event.
6353
event: pull_request
6454
allow_forks: true
65-
66-
67-
# We use a wildcard (*) because the artifact name from the build workflow
68-
# contains a dynamic commit SHA (e.g., vscode-reh-web-linux-x64-0.0.0-dev-...).
6955
name: npm-package
70-
# The path where the downloaded artifact will be saved.
7156
path: ./release-assets
72-
# Ensure we only get the artifact from a successful run.
7357
workflow_conclusion: success
7458

75-
# Step 3: Prepare the release assets by renaming the artifact.
76-
# This takes the downloaded file and gives it a clean, versioned name.
59+
# Step 4: Rename the artifact to a standardized release filename
7760
- name: Prepare release assets
7861
id: prepare_assets
7962
run: |
80-
# Find the downloaded tarball (there should only be one).
8163
ARTIFACT_FILE=$(find ./release-assets -name "*.tar.gz")
82-
8364
if [ -z "$ARTIFACT_FILE" ]; then
8465
echo "::error::Build artifact not found in ./release-assets! Make sure the 'Build' workflow ran successfully on the '${{ github.event.inputs.source_branch }}' branch."
8566
exit 1
8667
fi
87-
88-
# Get the version from the manual input, and remove the leading 'v' if it exists.
8968
VERSION_TAG="${{ github.event.inputs.version }}"
9069
VERSION_NUM="${VERSION_TAG#v}"
91-
92-
# Create the new, clean filename for the release.
93-
# This is the standardized name that your conda-forge recipe will expect.
9470
NEW_FILENAME="code-editor${VERSION_NUM}.tar.gz"
95-
96-
# Rename the file.
9771
mv "$ARTIFACT_FILE" "./release-assets/$NEW_FILENAME"
98-
9972
echo "Renamed artifact to $NEW_FILENAME"
100-
# Set the new filename as an output for the next step.
10173
echo "filename=./release-assets/$NEW_FILENAME" >> $GITHUB_OUTPUT
10274
103-
# Step 4: Create the GitHub Release and upload the prepared asset.
104-
# This action creates the tag, the release, and uploads your .tar.gz file.
75+
# Step 5: Create the release and upload the asset, also create the tag
76+
# This step will generate release notes, tag, and ensure all times match
10577
- name: Create GitHub Release
10678
uses: softprops/action-gh-release@v2
10779
with:
108-
# The name of the release, e.g., "Release v1.8.0".
10980
name: CodeEditor ${{ github.event.inputs.version }}
110-
# The Git tag to create, e.g., "v1.8.0".
11181
tag_name: ${{ github.event.inputs.version }}
112-
# Path to the file(s) to upload as release assets.
11382
files: ${{ steps.prepare_assets.outputs.filename }}
114-
# Set to 'false' to publish immediately, or 'true' to create a draft.
11583
draft: false
116-
# Automatically generate release notes from commits since the last release.
11784
generate_release_notes: true
118-

0 commit comments

Comments
 (0)