mirror of
https://github.com/oven-sh/setup-bun.git
synced 2025-02-22 09:40:12 +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
|
||||
|
||||
inputs:
|
||||
bun-version:
|
||||
description: "The version of Bun to compare against"
|
||||
description: The version of Bun to compare against
|
||||
required: true
|
||||
default: "1.1.0"
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
using: composite
|
||||
steps:
|
||||
- name: Get installed Bun version
|
||||
- name: 🛠️ Get installed Bun version
|
||||
id: bun
|
||||
shell: bash
|
||||
run: |
|
||||
bun --version
|
||||
echo "version=$(bun --version)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Compare versions
|
||||
- name: ⚖️ Compare versions
|
||||
shell: bash
|
||||
run: |
|
||||
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:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
- name: 📥 Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup Node
|
||||
|
||||
- name: 🛠️ Setup Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20.x
|
||||
- name: Install Dependencies
|
||||
|
||||
- name: 📦 Install Dependencies
|
||||
run: npm install
|
||||
- name: Format
|
||||
|
||||
- name: 🧹 Format
|
||||
run: |
|
||||
npm run format
|
||||
npm run build
|
||||
- name: Commit
|
||||
|
||||
- name: 💾 Commit
|
||||
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:
|
||||
release:
|
||||
types: [released]
|
||||
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
TAG_NAME:
|
||||
description: 'Tag name that the major tag will point to'
|
||||
description: Tag name that the major tag will point to
|
||||
required: true
|
||||
|
||||
env:
|
||||
TAG_NAME: ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }}
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
update_tag:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/publish-action@v0.3.0
|
||||
env:
|
||||
TAG_NAME: ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }}
|
||||
with:
|
||||
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:
|
||||
workflow_dispatch:
|
||||
@ -15,21 +15,11 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
permissions: write-all
|
||||
steps:
|
||||
- name: Checkout
|
||||
- name: 📥 Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install github cli
|
||||
run: |
|
||||
(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
|
||||
- name: 🗑️ Remove cache
|
||||
run: gh cache delete --all || true
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
|
||||
@ -37,6 +27,7 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
continue-on-error: true
|
||||
needs: [remove-cache]
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
os:
|
||||
@ -54,17 +45,18 @@ jobs:
|
||||
# Disable <sha> support for now. This is because Github Artifacts
|
||||
# expire after 90 days, and we don't have another source of truth yet.
|
||||
# - "822a00c4d508b54f650933a73ca5f4a3af9a7983" # 1.0.0 commit
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
- name: 📥 Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Bun
|
||||
- name: 🛠️ Setup Bun
|
||||
uses: ./
|
||||
id: setup_bun
|
||||
with:
|
||||
bun-version: ${{ matrix.bun-version }}
|
||||
|
||||
- name: Run Bun
|
||||
- name: ▶️ Run Bun
|
||||
id: run_bun
|
||||
run: |
|
||||
bun --version
|
||||
@ -80,52 +72,56 @@ jobs:
|
||||
- ubuntu-latest
|
||||
- macos-latest
|
||||
- windows-latest
|
||||
|
||||
file:
|
||||
- name: package.json (bun@1.1.0)
|
||||
file: package.json
|
||||
run: |
|
||||
echo "$(jq '. += {"packageManager": "bun@1.1.0"}' package.json)" > package.json
|
||||
|
||||
- name: /foo/package.json (bun@1.1.0)
|
||||
file: /foo/package.json
|
||||
run: |
|
||||
echo "$(jq '. += {"packageManager": "bun@1.1.0"}' package.json)" > /foo/package.json
|
||||
|
||||
- name: package.json (yarn@bun@1.1.0)
|
||||
file: package.json
|
||||
run: |
|
||||
echo "$(jq '. += {"packageManager": "yarn@bun@1.1.0"}' package.json)" > package.json
|
||||
|
||||
- name: .tool-versions (bun 1.1.0)
|
||||
file: .tool-versions
|
||||
run: |
|
||||
echo "bun 1.1.0" > .tool-versions
|
||||
run: echo "bun 1.1.0" > .tool-versions
|
||||
|
||||
- name: .tool-versions (bun1.1.0)
|
||||
file: .tool-versions
|
||||
run: |
|
||||
echo "bun1.1.0" > .tool-versions
|
||||
run: echo "bun1.1.0" > .tool-versions
|
||||
|
||||
- name: .tool-versions (bun 1.1.0)
|
||||
file: .tool-versions
|
||||
run: |
|
||||
echo "bun 1.1.0" > .tool-versions
|
||||
run: echo "bun 1.1.0" > .tool-versions
|
||||
|
||||
- name: .bumrc (1.1.0)
|
||||
file: .bumrc
|
||||
run: |
|
||||
echo "1.1.0" > .bumrc
|
||||
run: echo "1.1.0" > .bumrc
|
||||
|
||||
- name: .bun-version (1.1.0)
|
||||
file: .bun-version
|
||||
run: |
|
||||
echo "1.1.0" > .bun-version
|
||||
run: echo "1.1.0" > .bun-version
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
- name: 📥 Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup file
|
||||
- name: 📄 Setup file
|
||||
run: ${{ matrix.file.run }}
|
||||
|
||||
- name: Setup Bun
|
||||
- name: 🛠️ Setup Bun
|
||||
uses: ./
|
||||
with:
|
||||
bun-version-file: ${{ matrix.file.file }}
|
||||
|
||||
- name: Compare versions
|
||||
- name: ⚖️ Compare versions
|
||||
uses: ./.github/actions/compare-bun-version
|
||||
with:
|
||||
bun-version: "1.1.0"
|
||||
@ -135,23 +131,25 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
continue-on-error: true
|
||||
needs: [remove-cache]
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-latest
|
||||
- macos-latest
|
||||
- windows-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
- name: 📥 Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Bun
|
||||
- name: 🛠️ Setup Bun
|
||||
uses: ./
|
||||
id: setup_bun
|
||||
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"
|
||||
|
||||
- name: Run Bun
|
||||
- name: ▶️ Run Bun
|
||||
id: run_bun
|
||||
run: |
|
||||
bun --version
|
||||
|
15
action.yml
15
action.yml
@ -1,31 +1,34 @@
|
||||
name: Setup Bun
|
||||
description: Download, install, and setup Bun to your path.
|
||||
author: robobun
|
||||
|
||||
branding:
|
||||
icon: play-circle
|
||||
color: white
|
||||
|
||||
inputs:
|
||||
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
|
||||
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
|
||||
required: false
|
||||
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
|
||||
registry-url:
|
||||
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:
|
||||
required: false
|
||||
description: "The scope for authenticating with the package registry."
|
||||
description: The scope for authenticating with the package registry.
|
||||
no-cache:
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
description: "Disable caching of bun executable."
|
||||
description: Disable caching of bun executable.
|
||||
|
||||
outputs:
|
||||
bun-version:
|
||||
description: The version of Bun that was installed.
|
||||
|
Loading…
x
Reference in New Issue
Block a user