mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
272 lines
8.0 KiB
YAML
272 lines
8.0 KiB
YAML
name: bun-release
|
|
concurrency: release
|
|
on:
|
|
release:
|
|
types:
|
|
- published
|
|
workflow_dispatch:
|
|
inputs:
|
|
tag:
|
|
type: string
|
|
description: The tag to publish
|
|
required: true
|
|
jobs:
|
|
sign:
|
|
name: Sign Release
|
|
permissions: write-all
|
|
runs-on: ubuntu-latest
|
|
if: github.repository_owner == 'oven-sh'
|
|
defaults:
|
|
run:
|
|
working-directory: packages/bun-release
|
|
steps:
|
|
- id: checkout
|
|
name: Checkout
|
|
uses: actions/checkout@v3
|
|
- id: setup-env
|
|
name: Setup Environment
|
|
run: |
|
|
TAG="${{ github.event.inputs.tag }}"
|
|
TAG="${TAG:-"${{ github.event.release.tag_name }}"}"
|
|
echo "Setup tag: ${TAG}"
|
|
echo "TAG=${TAG}" >> ${GITHUB_ENV}
|
|
- id: setup-gpg
|
|
name: Setup GPG
|
|
uses: crazy-max/ghaction-import-gpg@v5
|
|
with:
|
|
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
|
|
passphrase: ${{ secrets.GPG_PASSPHRASE }}
|
|
- id: setup-bun
|
|
name: Setup Bun
|
|
uses: oven-sh/setup-bun@v1
|
|
with:
|
|
bun-version: canary
|
|
- id: bun-install
|
|
name: Install Dependencies
|
|
run: bun install
|
|
- id: bun-run
|
|
name: Sign Release
|
|
run: |
|
|
echo "$GPG_PASSPHRASE" | bun upload-assets -- "${{ env.TAG }}"
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
|
|
npm:
|
|
name: Release to NPM
|
|
runs-on: ubuntu-latest
|
|
permissions: write-all
|
|
needs: sign
|
|
if: github.repository_owner == 'oven-sh'
|
|
defaults:
|
|
run:
|
|
working-directory: packages/bun-release
|
|
steps:
|
|
- id: checkout
|
|
name: Checkout
|
|
uses: actions/checkout@v3
|
|
- id: setup-env
|
|
name: Setup Environment
|
|
run: |
|
|
TAG="${{ github.event.inputs.tag }}"
|
|
TAG="${TAG:-"${{ github.event.release.tag_name }}"}"
|
|
echo "Setup tag: ${TAG}"
|
|
echo "TAG=${TAG}" >> ${GITHUB_ENV}
|
|
- id: setup-bun
|
|
name: Setup Bun
|
|
uses: oven-sh/setup-bun@v1
|
|
with:
|
|
bun-version: canary
|
|
- id: bun-install
|
|
name: Install Dependencies
|
|
run: bun install
|
|
- id: bun-run
|
|
name: Release
|
|
run: bun upload-npm -- "${{ env.TAG }}" publish
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
npm-types:
|
|
name: Release types to NPM
|
|
runs-on: ubuntu-latest
|
|
needs: sign
|
|
if: github.repository_owner == 'oven-sh'
|
|
defaults:
|
|
run:
|
|
working-directory: packages/bun-types
|
|
steps:
|
|
- id: checkout
|
|
name: Checkout
|
|
uses: actions/checkout@v3
|
|
- id: setup-env
|
|
name: Setup Environment
|
|
run: |
|
|
TAG="${{ github.event.inputs.tag }}"
|
|
TAG="${TAG:-"${{ github.event.release.tag_name }}"}"
|
|
echo "Setup tag: ${TAG}"
|
|
echo "TAG=${TAG}" >> ${GITHUB_ENV}
|
|
- id: setup-node
|
|
name: Setup Node.js
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: latest
|
|
- id: setup-bun
|
|
name: Setup Bun
|
|
uses: oven-sh/setup-bun@v1
|
|
with:
|
|
bun-version: canary
|
|
- id: bun-install
|
|
name: Install Dependencies
|
|
run: bun install
|
|
- id: bun-run
|
|
name: Build
|
|
run: bun run build
|
|
env:
|
|
BUN_VERSION: ${{ env.TAG }}
|
|
- id: npm-publish
|
|
name: Release
|
|
uses: JS-DevTools/npm-publish@v1
|
|
with:
|
|
package: packages/bun-types/dist/package.json
|
|
token: ${{ secrets.NPM_TOKEN }}
|
|
docker:
|
|
name: Release to Dockerhub (${{ matrix.variant }})
|
|
runs-on: ubuntu-latest
|
|
needs: sign
|
|
if: github.repository_owner == 'oven-sh'
|
|
strategy:
|
|
matrix:
|
|
variant:
|
|
- debian
|
|
- slim
|
|
- alpine
|
|
- distroless
|
|
steps:
|
|
- id: checkout
|
|
name: Checkout
|
|
uses: actions/checkout@v3
|
|
- id: environment
|
|
name: Setup Environment
|
|
run: |
|
|
TAG="${{ github.event.inputs.tag }}"
|
|
TAG="${TAG:-"${{ github.event.release.tag_name }}"}"
|
|
echo "Setup tag: ${TAG}"
|
|
echo "TAG=${TAG}" >> ${GITHUB_ENV}
|
|
- id: qemu
|
|
name: Setup Docker QEMU
|
|
uses: docker/setup-qemu-action@v2
|
|
- id: buildx
|
|
name: Setup Docker buildx
|
|
uses: docker/setup-buildx-action@v2
|
|
with:
|
|
platforms: linux/amd64,linux/arm64
|
|
- id: metadata
|
|
name: Setup Docker metadata
|
|
uses: docker/metadata-action@v4
|
|
with:
|
|
images: oven/bun
|
|
flavor: |
|
|
latest=${{ matrix.variant == 'debian' }}
|
|
suffix=${{ matrix.variant }}
|
|
tags: |
|
|
type=match,pattern=(bun-v)?(\d+.\d+.\d+),group=2,value=${{ env.TAG }}
|
|
type=match,pattern=(bun-v)?(\d+.\d+),group=2,value=${{ env.TAG }}
|
|
type=match,pattern=(bun-v)?(\d+),group=2,value=${{ env.TAG }}
|
|
- id: login
|
|
name: Login to Docker
|
|
uses: docker/login-action@v2
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
- id: push
|
|
name: Push to Docker
|
|
uses: docker/build-push-action@v3
|
|
with:
|
|
context: ./dockerhub/${{ matrix.variant }}
|
|
platforms: linux/amd64,linux/arm64
|
|
builder: ${{ steps.buildx.outputs.name }}
|
|
push: true
|
|
tags: ${{ steps.metadata.outputs.tags }}
|
|
labels: ${{ steps.metadata.outputs.labels }}
|
|
build-args: |
|
|
BUN_VERSION=${{ env.TAG }}
|
|
homebrew:
|
|
name: Release to Homebrew
|
|
permissions: write-all
|
|
runs-on: ubuntu-latest
|
|
needs: sign
|
|
if: github.repository_owner == 'oven-sh'
|
|
steps:
|
|
- id: checkout
|
|
name: Checkout
|
|
uses: actions/checkout@v3
|
|
with:
|
|
repository: oven-sh/homebrew-bun
|
|
token: ${{ secrets.ROBOBUN_TOKEN }}
|
|
- id: setup-gpg
|
|
name: Setup GPG
|
|
uses: crazy-max/ghaction-import-gpg@v5
|
|
with:
|
|
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
|
|
passphrase: ${{ secrets.GPG_PASSPHRASE }}
|
|
- id: setup-env
|
|
name: Setup Environment
|
|
run: |
|
|
TAG="${{ github.event.inputs.tag }}"
|
|
TAG="${TAG:-"${{ github.event.release.tag_name }}"}"
|
|
echo "Setup tag: ${TAG}"
|
|
echo "TAG=${TAG}" >> ${GITHUB_ENV}
|
|
- id: setup-ruby
|
|
name: Setup Ruby
|
|
uses: ruby/setup-ruby@v1
|
|
with:
|
|
ruby-version: "2.6"
|
|
- id: update-tap
|
|
name: Update Tap
|
|
run: ruby scripts/release.rb "${{ env.TAG }}"
|
|
- id: commit-tap
|
|
name: Commit Tap
|
|
uses: stefanzweifel/git-auto-commit-action@v4
|
|
with:
|
|
commit_options: --gpg-sign=${{ steps.setup-gpg.outputs.keyid }}
|
|
commit_message: Release ${{ env.TAG }}
|
|
commit_user_name: robobun
|
|
commit_user_email: robobun@oven.sh
|
|
commit_author: robobun <robobun@oven.sh>
|
|
s3:
|
|
name: Upload to S3
|
|
runs-on: ubuntu-latest
|
|
permissions: write-all
|
|
needs: sign
|
|
if: github.repository_owner == 'oven-sh'
|
|
defaults:
|
|
run:
|
|
working-directory: packages/bun-release
|
|
steps:
|
|
- id: checkout
|
|
name: Checkout
|
|
uses: actions/checkout@v3
|
|
- id: setup-env
|
|
name: Setup Environment
|
|
run: |
|
|
TAG="${{ github.event.inputs.tag }}"
|
|
TAG="${TAG:-"${{ github.event.release.tag_name }}"}"
|
|
echo "Setup tag: ${TAG}"
|
|
echo "TAG=${TAG}" >> ${GITHUB_ENV}
|
|
- id: setup-bun
|
|
name: Setup Bun
|
|
uses: oven-sh/setup-bun@v1
|
|
with:
|
|
bun-version: canary
|
|
- id: bun-install
|
|
name: Install Dependencies
|
|
run: bun install
|
|
- id: bun-run
|
|
name: Release
|
|
run: bun upload-s3 -- "${{ env.TAG }}"
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY}}
|
|
AWS_ENDPOINT: ${{ secrets.AWS_ENDPOINT }}
|
|
AWS_BUCKET: bun
|