Using Github Actions with Bun

Jonas Scholz - Oct 7 '23 - - Dev Community

Still using Bun after last week's hype? Great! Let's learn together how you can use Github Actions and Bun 🚀🍞

Setup

I am assuming that you already have a GitHub repository with a working bun project. If not, you can find everything in this public GitHub Repository

Create a file in .github/workflows/test.yaml and copy-paste the following yaml. You will probably only need to change the last line!

name: Test Bun # Name it however you want

on:
  push:
    branches:
      - main # Execute on every push
  workflow_dispatch: # Execute on manual trigger

jobs:
  build-and-start:
    runs-on: ubuntu-latest # Linux base image
    steps:
      - uses: actions/checkout@v3 # Checkout repo
      - uses: oven-sh/setup-bun@v1 # Setup bun
        with:
            bun-version: latest # You can also use a specific version
      - run: bun install # Only needed if you have any dependencies
      - run: bun ./print.ts # Change to your entrypoint!
Enter fullscreen mode Exit fullscreen mode

You can now see your Action runs here:

GitHub Actions

Conclusion

I'd love to know if you are already using Bun for a project! How has the journey been so far? And how are you going to use Github Actions for it? 😊

. . . . . . . . . . . . . . . . . . . . . .