mirror of
https://github.com/oven-sh/setup-bun.git
synced 2025-02-23 02:30:26 +08:00
ci: remove unnecessary steps & cleanup (#118)
* refactor(ci): refactor GitHub Actions for better readablility * upd * remove ""
This commit is contained in:
parent
6fb6603cc1
commit
54cb141c5c
10
.github/actions/compare-bun-version/action.yml
vendored
10
.github/actions/compare-bun-version/action.yml
vendored
@ -1,23 +1,23 @@
|
|||||||
name: Compare Bun Version
|
name: ⚖️ Compare Bun Version
|
||||||
description: Compare the version of Bun to a specified version
|
description: Compare the version of Bun to a specified version
|
||||||
|
|
||||||
inputs:
|
inputs:
|
||||||
bun-version:
|
bun-version:
|
||||||
description: "The version of Bun to compare against"
|
description: The version of Bun to compare against
|
||||||
required: true
|
required: true
|
||||||
default: "1.1.0"
|
default: "1.1.0"
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: composite
|
||||||
steps:
|
steps:
|
||||||
- name: Get installed Bun version
|
- name: 🛠️ Get installed Bun version
|
||||||
id: bun
|
id: bun
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
bun --version
|
bun --version
|
||||||
echo "version=$(bun --version)" >> $GITHUB_OUTPUT
|
echo "version=$(bun --version)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Compare versions
|
- name: ⚖️ Compare versions
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
if [[ "${{ steps.bun.outputs.version }}" == "${{ inputs.bun-version }}" ]]; then
|
if [[ "${{ steps.bun.outputs.version }}" == "${{ inputs.bun-version }}" ]]; then
|
||||||
|
14
.github/workflows/format.yml
vendored
14
.github/workflows/format.yml
vendored
@ -14,17 +14,21 @@ jobs:
|
|||||||
format:
|
format:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: 📥 Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: Setup Node
|
|
||||||
|
- name: 🛠️ Setup Node
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 20.x
|
node-version: 20.x
|
||||||
- name: Install Dependencies
|
|
||||||
|
- name: 📦 Install Dependencies
|
||||||
run: npm install
|
run: npm install
|
||||||
- name: Format
|
|
||||||
|
- name: 🧹 Format
|
||||||
run: |
|
run: |
|
||||||
npm run format
|
npm run format
|
||||||
npm run build
|
npm run build
|
||||||
- name: Commit
|
|
||||||
|
- name: 💾 Commit
|
||||||
uses: autofix-ci/action@d3e591514b99d0fca6779455ff8338516663f7cc
|
uses: autofix-ci/action@d3e591514b99d0fca6779455ff8338516663f7cc
|
||||||
|
14
.github/workflows/release.yml
vendored
14
.github/workflows/release.yml
vendored
@ -1,25 +1,27 @@
|
|||||||
name: Release new action version
|
name: 🚀 Release new action version
|
||||||
|
|
||||||
on:
|
on:
|
||||||
release:
|
release:
|
||||||
types: [released]
|
types: [released]
|
||||||
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
TAG_NAME:
|
TAG_NAME:
|
||||||
description: 'Tag name that the major tag will point to'
|
description: Tag name that the major tag will point to
|
||||||
required: true
|
required: true
|
||||||
|
|
||||||
env:
|
permissions:
|
||||||
TAG_NAME: ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }}
|
contents: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
update_tag:
|
update_tag:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- uses: actions/publish-action@v0.3.0
|
- uses: actions/publish-action@v0.3.0
|
||||||
|
env:
|
||||||
|
TAG_NAME: ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }}
|
||||||
with:
|
with:
|
||||||
source-tag: ${{ env.TAG_NAME }}
|
source-tag: ${{ env.TAG_NAME }}
|
||||||
|
66
.github/workflows/test.yml
vendored
66
.github/workflows/test.yml
vendored
@ -1,4 +1,4 @@
|
|||||||
name: Test
|
name: 🧪 Test
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
@ -15,21 +15,11 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions: write-all
|
permissions: write-all
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: 📥 Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install github cli
|
- name: 🗑️ Remove cache
|
||||||
run: |
|
run: gh cache delete --all || true
|
||||||
(type -p wget >/dev/null || (sudo apt update && sudo apt-get install wget -y)) \
|
|
||||||
&& sudo mkdir -p -m 755 /etc/apt/keyrings \
|
|
||||||
&& wget -qO- https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \
|
|
||||||
&& sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \
|
|
||||||
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
|
|
||||||
&& sudo apt update \
|
|
||||||
&& sudo apt install gh -y
|
|
||||||
|
|
||||||
- run: |
|
|
||||||
gh cache delete --all || true
|
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ github.token }}
|
GH_TOKEN: ${{ github.token }}
|
||||||
|
|
||||||
@ -37,6 +27,7 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
needs: [remove-cache]
|
needs: [remove-cache]
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os:
|
os:
|
||||||
@ -54,17 +45,18 @@ jobs:
|
|||||||
# Disable <sha> support for now. This is because Github Artifacts
|
# Disable <sha> support for now. This is because Github Artifacts
|
||||||
# expire after 90 days, and we don't have another source of truth yet.
|
# expire after 90 days, and we don't have another source of truth yet.
|
||||||
# - "822a00c4d508b54f650933a73ca5f4a3af9a7983" # 1.0.0 commit
|
# - "822a00c4d508b54f650933a73ca5f4a3af9a7983" # 1.0.0 commit
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: 📥 Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup Bun
|
- name: 🛠️ Setup Bun
|
||||||
uses: ./
|
uses: ./
|
||||||
id: setup_bun
|
id: setup_bun
|
||||||
with:
|
with:
|
||||||
bun-version: ${{ matrix.bun-version }}
|
bun-version: ${{ matrix.bun-version }}
|
||||||
|
|
||||||
- name: Run Bun
|
- name: ▶️ Run Bun
|
||||||
id: run_bun
|
id: run_bun
|
||||||
run: |
|
run: |
|
||||||
bun --version
|
bun --version
|
||||||
@ -80,52 +72,56 @@ jobs:
|
|||||||
- ubuntu-latest
|
- ubuntu-latest
|
||||||
- macos-latest
|
- macos-latest
|
||||||
- windows-latest
|
- windows-latest
|
||||||
|
|
||||||
file:
|
file:
|
||||||
- name: package.json (bun@1.1.0)
|
- name: package.json (bun@1.1.0)
|
||||||
file: package.json
|
file: package.json
|
||||||
run: |
|
run: |
|
||||||
echo "$(jq '. += {"packageManager": "bun@1.1.0"}' package.json)" > package.json
|
echo "$(jq '. += {"packageManager": "bun@1.1.0"}' package.json)" > package.json
|
||||||
|
|
||||||
- name: /foo/package.json (bun@1.1.0)
|
- name: /foo/package.json (bun@1.1.0)
|
||||||
file: /foo/package.json
|
file: /foo/package.json
|
||||||
run: |
|
run: |
|
||||||
echo "$(jq '. += {"packageManager": "bun@1.1.0"}' package.json)" > /foo/package.json
|
echo "$(jq '. += {"packageManager": "bun@1.1.0"}' package.json)" > /foo/package.json
|
||||||
|
|
||||||
- name: package.json (yarn@bun@1.1.0)
|
- name: package.json (yarn@bun@1.1.0)
|
||||||
file: package.json
|
file: package.json
|
||||||
run: |
|
run: |
|
||||||
echo "$(jq '. += {"packageManager": "yarn@bun@1.1.0"}' package.json)" > package.json
|
echo "$(jq '. += {"packageManager": "yarn@bun@1.1.0"}' package.json)" > package.json
|
||||||
|
|
||||||
- name: .tool-versions (bun 1.1.0)
|
- name: .tool-versions (bun 1.1.0)
|
||||||
file: .tool-versions
|
file: .tool-versions
|
||||||
run: |
|
run: echo "bun 1.1.0" > .tool-versions
|
||||||
echo "bun 1.1.0" > .tool-versions
|
|
||||||
- name: .tool-versions (bun1.1.0)
|
- name: .tool-versions (bun1.1.0)
|
||||||
file: .tool-versions
|
file: .tool-versions
|
||||||
run: |
|
run: echo "bun1.1.0" > .tool-versions
|
||||||
echo "bun1.1.0" > .tool-versions
|
|
||||||
- name: .tool-versions (bun 1.1.0)
|
- name: .tool-versions (bun 1.1.0)
|
||||||
file: .tool-versions
|
file: .tool-versions
|
||||||
run: |
|
run: echo "bun 1.1.0" > .tool-versions
|
||||||
echo "bun 1.1.0" > .tool-versions
|
|
||||||
- name: .bumrc (1.1.0)
|
- name: .bumrc (1.1.0)
|
||||||
file: .bumrc
|
file: .bumrc
|
||||||
run: |
|
run: echo "1.1.0" > .bumrc
|
||||||
echo "1.1.0" > .bumrc
|
|
||||||
- name: .bun-version (1.1.0)
|
- name: .bun-version (1.1.0)
|
||||||
file: .bun-version
|
file: .bun-version
|
||||||
run: |
|
run: echo "1.1.0" > .bun-version
|
||||||
echo "1.1.0" > .bun-version
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: 📥 Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup file
|
- name: 📄 Setup file
|
||||||
run: ${{ matrix.file.run }}
|
run: ${{ matrix.file.run }}
|
||||||
|
|
||||||
- name: Setup Bun
|
- name: 🛠️ Setup Bun
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
bun-version-file: ${{ matrix.file.file }}
|
bun-version-file: ${{ matrix.file.file }}
|
||||||
|
|
||||||
- name: Compare versions
|
- name: ⚖️ Compare versions
|
||||||
uses: ./.github/actions/compare-bun-version
|
uses: ./.github/actions/compare-bun-version
|
||||||
with:
|
with:
|
||||||
bun-version: "1.1.0"
|
bun-version: "1.1.0"
|
||||||
@ -135,23 +131,25 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
needs: [remove-cache]
|
needs: [remove-cache]
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os:
|
os:
|
||||||
- ubuntu-latest
|
- ubuntu-latest
|
||||||
- macos-latest
|
- macos-latest
|
||||||
- windows-latest
|
- windows-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: 📥 Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup Bun
|
- name: 🛠️ Setup Bun
|
||||||
uses: ./
|
uses: ./
|
||||||
id: setup_bun
|
id: setup_bun
|
||||||
with:
|
with:
|
||||||
bun-download-url: "https://github.com/oven-sh/bun/releases/latest/download/bun-${{runner.os == 'macOS' && 'darwin' || runner.os}}-${{ runner.arch == 'X64' && 'x64' || 'aarch64' }}.zip"
|
bun-download-url: "https://github.com/oven-sh/bun/releases/latest/download/bun-${{runner.os == 'macOS' && 'darwin' || runner.os}}-${{ runner.arch == 'X64' && 'x64' || 'aarch64' }}.zip"
|
||||||
|
|
||||||
- name: Run Bun
|
- name: ▶️ Run Bun
|
||||||
id: run_bun
|
id: run_bun
|
||||||
run: |
|
run: |
|
||||||
bun --version
|
bun --version
|
||||||
|
15
action.yml
15
action.yml
@ -1,31 +1,34 @@
|
|||||||
name: Setup Bun
|
name: Setup Bun
|
||||||
description: Download, install, and setup Bun to your path.
|
description: Download, install, and setup Bun to your path.
|
||||||
author: robobun
|
author: robobun
|
||||||
|
|
||||||
branding:
|
branding:
|
||||||
icon: play-circle
|
icon: play-circle
|
||||||
color: white
|
color: white
|
||||||
|
|
||||||
inputs:
|
inputs:
|
||||||
bun-version:
|
bun-version:
|
||||||
description: 'The version of Bun to install. (e.g. "latest", "canary", "1.0.0", "1.0.x", <sha>)'
|
description: The version of Bun to install. (e.g. "latest", "canary", "1.0.0", "1.0.x", <sha>)
|
||||||
required: false
|
required: false
|
||||||
bun-version-file:
|
bun-version-file:
|
||||||
description: 'The version of Bun to install from file. (e.g. "package.json", ".bun-version", ".tool-versions")'
|
description: The version of Bun to install from file. (e.g. "package.json", ".bun-version", ".tool-versions")
|
||||||
default: null
|
default: null
|
||||||
required: false
|
required: false
|
||||||
bun-download-url:
|
bun-download-url:
|
||||||
description: "Override the URL to download Bun from. This skips version resolution and verifying AVX2 support."
|
description: Override the URL to download Bun from. This skips version resolution and verifying AVX2 support.
|
||||||
required: false
|
required: false
|
||||||
registry-url:
|
registry-url:
|
||||||
required: false
|
required: false
|
||||||
description: "The URL of the package registry to use for installing Bun. Set the $BUN_AUTH_TOKEN environment variable to authenticate with the registry."
|
description: The URL of the package registry to use for installing Bun. Set the $BUN_AUTH_TOKEN environment variable to authenticate with the registry.
|
||||||
scope:
|
scope:
|
||||||
required: false
|
required: false
|
||||||
description: "The scope for authenticating with the package registry."
|
description: The scope for authenticating with the package registry.
|
||||||
no-cache:
|
no-cache:
|
||||||
required: false
|
required: false
|
||||||
type: boolean
|
type: boolean
|
||||||
default: false
|
default: false
|
||||||
description: "Disable caching of bun executable."
|
description: Disable caching of bun executable.
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
bun-version:
|
bun-version:
|
||||||
description: The version of Bun that was installed.
|
description: The version of Bun that was installed.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user