synclounge/.github/workflows/ci.yml

66 lines
2.1 KiB
YAML

name: ci
on:
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
ci:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
dockerfile:
- Dockerfile
- Dockerfile.web
include:
- dockerfile: Dockerfile
docker-image: localhost:5000/${{ github.event.repository.full_name }}
- dockerfile: Dockerfile.web
docker-image: localhost:5000/${{ github.event.repository.full_name }}web
steps:
- name: Checkout
uses: actions/checkout@v4.1.1
- name: Repo metadata
id: repo
uses: actions/github-script@v7.0.1
with:
script: |
const repo = await github.rest.repos.get(context.repo)
return repo.data
- name: Prepare
id: prep
run: |
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3.0.0
with:
version: latest
- name: Build and push
id: docker-build
uses: docker/build-push-action@v5.1.0
with:
builder: ${{ steps.buildx.outputs.name }}
context: .
file: ./${{ matrix.dockerfile}}
tags: ${{ matrix.docker-image }}:${{ github.sha }}
labels: |
org.opencontainers.image.title=${{ fromJson(steps.repo.outputs.result).name }}
org.opencontainers.image.description=${{ fromJson(steps.repo.outputs.result).description }}
org.opencontainers.image.url=${{ fromJson(steps.repo.outputs.result).html_url }}
org.opencontainers.image.source=${{ fromJson(steps.repo.outputs.result).clone_url }}
org.opencontainers.image.created=${{ steps.prep.outputs.created }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.licenses=${{ fromJson(steps.repo.outputs.result).license.spdx_id }}
cache-from: type=gha
cache-to: type=gha,mode=max