-
-
Notifications
You must be signed in to change notification settings - Fork 6
53 lines (46 loc) · 1.69 KB
/
Copy pathupload-yarn-binary.yml
File metadata and controls
53 lines (46 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
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@v6
- 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
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}"