Skip to content

Merge pull request #31 from LuisMSuarez/build-container #13

Merge pull request #31 from LuisMSuarez/build-container

Merge pull request #31 from LuisMSuarez/build-container #13

Workflow file for this run

name: Build with Bun
on:
push:
branches: [master]
pull_request:
branches: [master]
env:
REGISTRY: ghcr.io
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read # Required for actions/checkout
packages: write # Required to publish docker image
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Bun
run: |
curl -fsSL https://bun.sh/install | bash
echo "$HOME/.bun/bin" >> $GITHUB_PATH
- name: Install dependencies
run: bun install
- name: Build
run: bun run build
- name: Upload client artifact for deployment job
uses: actions/upload-artifact@v4
with:
name: client-app
path: packages/client/dist
- name: Upload server artifact for deployment job
uses: actions/upload-artifact@v4
with:
name: server-app
path: packages/server/dist
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Lowercase the repo name and username as container tags must be lowercase
run: echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV}
- name: Build and push container image to registry
id: push
uses: docker/build-push-action@v5
with:
push: ${{ github.event_name == 'push' }} # always build the container (incl. Pull Requests), but only push to the registry on code push
tags: ${{ env.REGISTRY }}/${{ env.REPO }}:${{ github.sha }}
file: ./Dockerfile