mirror of
https://github.com/TecharoHQ/anubis.git
synced 2025-10-04 05:41:59 +08:00
85 lines
2.4 KiB
YAML
85 lines
2.4 KiB
YAML
name: Docker image builds
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches: ["main"]
|
|
tags: ["v*"]
|
|
|
|
env:
|
|
DOCKER_METADATA_SET_OUTPUT_ENV: "true"
|
|
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
attestations: write
|
|
id-token: write
|
|
pull-requests: write
|
|
|
|
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: Set lowercase image name
|
|
run: |
|
|
echo "IMAGE=ghcr.io/${GITHUB_REPOSITORY,,}" >> $GITHUB_ENV
|
|
|
|
- name: Set up Homebrew
|
|
uses: Homebrew/actions/setup-homebrew@main
|
|
|
|
- name: Setup Homebrew cellar cache
|
|
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
|
|
with:
|
|
path: |
|
|
/home/linuxbrew/.linuxbrew/Cellar
|
|
/home/linuxbrew/.linuxbrew/bin
|
|
/home/linuxbrew/.linuxbrew/etc
|
|
/home/linuxbrew/.linuxbrew/include
|
|
/home/linuxbrew/.linuxbrew/lib
|
|
/home/linuxbrew/.linuxbrew/opt
|
|
/home/linuxbrew/.linuxbrew/sbin
|
|
/home/linuxbrew/.linuxbrew/share
|
|
/home/linuxbrew/.linuxbrew/var
|
|
key: ${{ runner.os }}-go-homebrew-cellar-${{ hashFiles('go.sum') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-go-homebrew-cellar-
|
|
|
|
- name: Install Brew dependencies
|
|
run: |
|
|
brew bundle
|
|
|
|
- name: Log into registry
|
|
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Docker meta
|
|
id: meta
|
|
uses: docker/metadata-action@c1e51972afc2121e065aed6d45c65596fe445f3f # v5.8.0
|
|
with:
|
|
images: ${{ env.IMAGE }}
|
|
|
|
- name: Build and push
|
|
id: build
|
|
run: |
|
|
npm ci
|
|
npm run container
|
|
env:
|
|
DOCKER_REPO: ${{ env.IMAGE }}
|
|
SLOG_LEVEL: debug
|
|
|
|
- name: Generate artifact attestation
|
|
uses: actions/attest-build-provenance@977bb373ede98d70efdf65b84cb5f73e068dcc2a # v3.0.0
|
|
with:
|
|
subject-name: ${{ env.IMAGE }}
|
|
subject-digest: ${{ steps.build.outputs.digest }}
|
|
push-to-registry: true
|