59 lines
1.5 KiB
YAML
59 lines
1.5 KiB
YAML
name: Docker image builds (pull requests)
|
|
|
|
on:
|
|
pull_request:
|
|
branches: ["main"]
|
|
|
|
env:
|
|
DOCKER_METADATA_SET_OUTPUT_ENV: "true"
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
|
with:
|
|
fetch-tags: true
|
|
fetch-depth: 0
|
|
persist-credentials: false
|
|
|
|
- name: build essential
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y build-essential
|
|
|
|
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
|
|
with:
|
|
node-version: latest
|
|
|
|
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
|
|
with:
|
|
go-version: stable
|
|
|
|
- uses: ko-build/setup-ko@d006021bd0c28d1ce33a07e7943d48b079944c8d # v0.9
|
|
|
|
- name: Docker meta
|
|
id: meta
|
|
uses: docker/metadata-action@318604b99e75e41977312d83839a89be02ca4893 # v5.9.0
|
|
with:
|
|
images: ghcr.io/${{ github.repository }}
|
|
|
|
- name: Build and push
|
|
id: build
|
|
run: |
|
|
npm ci
|
|
npm run container
|
|
env:
|
|
PULL_REQUEST_ID: ${{ github.event.number }}
|
|
DOCKER_REPO: ghcr.io/${{ github.repository }}
|
|
SLOG_LEVEL: debug
|
|
|
|
- run: |
|
|
echo "Test this with:"
|
|
echo "docker pull ${DOCKER_IMAGE}"
|
|
env:
|
|
DOCKER_IMAGE: ${{ steps.build.outputs.docker_image }}
|