-
-
Notifications
You must be signed in to change notification settings - Fork 5
feat: add workflow to upload Yarn binary to GitHub Release #74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
a92f16b
b20a5e9
5936b7b
df7148d
2ef7408
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| name: Upload Yarn Binary to GitHub Release | ||
|
|
||
| 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 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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}" | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Consider adding a
concurrencygroup to prevent multiple manual dispatches from clobbering the same release simultaneously, for example: