Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions .github/workflows/upload-yarn-binary.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Upload Yarn Binary to GitHub Release
Copy link

Copilot AI Jun 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider adding a concurrency group to prevent multiple manual dispatches from clobbering the same release simultaneously, for example:

concurrency:
  group: upload-yarn-binary-${{ github.event.inputs.yarn_version }}
  cancel-in-progress: false

Copilot uses AI. Check for mistakes.

on:
workflow_dispatch:
inputs:
yarn_version:
description: 'Yarn version to upload (e.g., 4.9.1)'
required: true
type: string

jobs:
upload-yarn-binary:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
env:
YARN_VERSION: ${{ github.event.inputs.yarn_version }}
YARN_FILENAME: yarn-${{ github.event.inputs.yarn_version }}.js
RELEASE_TAG: v${{ github.event.inputs.yarn_version }}
outputs:
download_url: ${{ steps.output-url.outputs.download_url }}
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Download yarn.js binary
run: |
curl -L -o "${YARN_FILENAME}" "https://repo.yarnpkg.com/${YARN_VERSION}/packages/yarnpkg-cli/bin/yarn.js"
ls -lh "${YARN_FILENAME}"

- name: Display SHA256 checksum
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the purpose of the showing the checksum, would be worth comparing it with the expected one if happens that you can fetch it once the download is completed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My idea was to check if we can use that checksum in the URL

run: |
sha256sum "${YARN_FILENAME}"

- name: Create or update GitHub Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release view "${RELEASE_TAG}" || gh release create "${RELEASE_TAG}" --title "Yarn ${YARN_VERSION}" --notes "Yarn CLI ${YARN_VERSION} binary."

- name: Upload yarn.js to GitHub Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload "${RELEASE_TAG}" "${YARN_FILENAME}" --clobber

- name: Output download URL
id: output-url
run: |
url="https://github.com/${GITHUB_REPOSITORY}/releases/download/${RELEASE_TAG}/${YARN_FILENAME}"
echo "Download URL: ${url}"
echo "download_url=${url}" >> "${GITHUB_OUTPUT}"
Loading