Skip to content

Commit

Permalink
ci: remove unnecessary steps & cleanup (#118)
Browse files Browse the repository at this point in the history
* refactor(ci): refactor GitHub Actions for better readablility

* upd

* remove ""
  • Loading branch information
okineadev authored Feb 4, 2025
1 parent 6fb6603 commit 54cb141
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 56 deletions.
10 changes: 5 additions & 5 deletions .github/actions/compare-bun-version/action.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 8 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
env:
TAG_NAME: ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }}
with:
source-tag: ${{ env.TAG_NAME }}
66 changes: 32 additions & 34 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test
name: 🧪 Test

on:
workflow_dispatch:
Expand All @@ -15,28 +15,19 @@ 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 }}

setup-bun:
runs-on: ${{ matrix.os }}
continue-on-error: true
needs: [remove-cache]

strategy:
matrix:
os:
Expand All @@ -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
Expand All @@ -80,52 +72,56 @@ jobs:
- ubuntu-latest
- macos-latest
- windows-latest

file:
- name: package.json ([email protected])
file: package.json
run: |
echo "$(jq '. += {"packageManager": "[email protected]"}' package.json)" > package.json
- name: /foo/package.json ([email protected])
file: /foo/package.json
run: |
echo "$(jq '. += {"packageManager": "[email protected]"}' package.json)" > /foo/package.json
- name: package.json (yarn@[email protected])
file: package.json
run: |
echo "$(jq '. += {"packageManager": "yarn@[email protected]"}' 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"
Expand All @@ -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 changes: 9 additions & 6 deletions action.yml
Original file line number Diff line number Diff line change
@@ -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.
Expand Down

0 comments on commit 54cb141

Please sign in to comment.