1111 type : string
1212 # This input allows you to specify which branch to create the release from.
1313 source_branch :
14- description : ' The branch to find the latest successful build artifact on .'
14+ description : ' The branch to find the artifact on and to tag for the release .'
1515 required : true
1616 type : string
1717 # We default to 'main' to make the most common case easy.
@@ -28,13 +28,19 @@ jobs:
2828 contents : write
2929
3030 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.
31+ # Step 1: Check out the repository code FROM THE SPECIFIED SOURCE BRANCH.
3332 - name : Checkout code
3433 uses : actions/checkout@v4
3534 with :
3635 ref : ${{ github.event.inputs.source_branch }}
3736
37+ # Step 2: Explicitly get the commit SHA of the checked-out branch HEAD.
38+ # This ensures we are using the correct commit for tagging.
39+ - name : Get commit SHA
40+ id : get_sha
41+ run : echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
42+
43+ # Step 3: Delete existing tag if you want to re-run the release.
3844 - name : Delete existing tag (if any)
3945 uses : actions/github-script@v7
4046 with :
@@ -50,31 +56,29 @@ jobs:
5056 } catch (e) {
5157 console.log(`Tag ${tag} does not exist or already deleted.`);
5258 }
53- # Step 2: Download the build artifact from your 'Build' workflow.
54- # This finds the latest successful run on the specified branch and downloads the artifact .
59+
60+ # Step 4: Download the build artifact from your 'Build' workflow .
5561 - name : Download artifact from build workflow
5662 uses : dawidd6/action-download-artifact@v6
5763 with :
5864 # IMPORTANT: This must match the 'name:' field in your build.yaml file.
5965 workflow : build.yml
60- # Use the branch from the manual input instead of hardcoding 'main' .
66+ # Use the branch from the manual input.
6167 branch : ${{ github.event.inputs.source_branch }}
6268
6369 # Tell the action to look for artifacts created by a 'pull_request' event.
6470 event : pull_request
6571 allow_forks : true
6672
67-
6873 # We use a wildcard (*) because the artifact name from the build workflow
69- # contains a dynamic commit SHA (e.g., vscode-reh-web-linux-x64-0.0.0-dev-...) .
74+ # contains a dynamic commit SHA.
7075 name : npm-package
7176 # The path where the downloaded artifact will be saved.
7277 path : ./release-assets
7378 # Ensure we only get the artifact from a successful run.
7479 workflow_conclusion : success
7580
76- # Step 3: Prepare the release assets by renaming the artifact.
77- # This takes the downloaded file and gives it a clean, versioned name.
81+ # Step 5: Prepare the release assets by renaming the artifact.
7882 - name : Prepare release assets
7983 id : prepare_assets
8084 run : |
9195 VERSION_NUM="${VERSION_TAG#v}"
9296
9397 # Create the new, clean filename for the release.
94- # This is the standardized name that your conda-forge recipe will expect.
98+
9599 NEW_FILENAME="code-editor${VERSION_NUM}.tar.gz"
96100
97101 # Rename the file.
@@ -100,8 +104,10 @@ jobs:
100104 echo "Renamed artifact to $NEW_FILENAME"
101105 # Set the new filename as an output for the next step.
102106 echo "filename=./release-assets/$NEW_FILENAME" >> $GITHUB_OUTPUT
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.
107+
108+
109+ # Step 6: Create the GitHub Release using the CORRECT commit SHA.
110+
105111 - name : Create GitHub Release
106112 uses : softprops/action-gh-release@v2
107113 with :
@@ -111,8 +117,11 @@ jobs:
111117 tag_name : ${{ github.event.inputs.version }}
112118 # Path to the file(s) to upload as release assets.
113119 files : ${{ steps.prepare_assets.outputs.filename }}
114- # Set to 'false' to publish immediately, or 'true' to create a draft .
120+ # Set to 'false' to publish immediately.
115121 draft : false
116- # Automatically generate release notes from commits since the last release .
122+ # Set to false as we are not using auto-generated notes .
117123 generate_release_notes : false
118-
124+ # CRITICAL: Force the tag to be created on the commit we explicitly got in Step 2.
125+ # This overrides any incorrect metadata from the downloaded artifact.
126+ target_commitish : ${{ steps.get_sha.outputs.sha }}
127+
0 commit comments