2025-01-06 23:54:07 -05:00
|
|
|
name: Docker Build and Publish
|
2023-11-17 01:44:01 -05:00
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2025-01-06 23:54:07 -05:00
|
|
|
branches: ["new"]
|
|
|
|
workflow_dispatch:
|
2023-11-17 01:44:01 -05:00
|
|
|
|
|
|
|
env:
|
|
|
|
REGISTRY: ghcr.io
|
|
|
|
IMAGE_NAME: ${{ github.repository }}
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
packages: write
|
|
|
|
id-token: write
|
|
|
|
|
|
|
|
steps:
|
2025-01-06 23:54:07 -05:00
|
|
|
- name: Checkout code
|
2023-11-17 01:44:01 -05:00
|
|
|
uses: actions/checkout@v3
|
2025-01-06 23:54:07 -05:00
|
|
|
|
|
|
|
- name: Setup Docker layer caching
|
|
|
|
uses: satackey/action-docker-layer-caching@v0.0.11
|
2024-07-29 01:09:25 -04:00
|
|
|
continue-on-error: true
|
2023-11-17 01:44:01 -05:00
|
|
|
|
2025-01-06 23:54:07 -05:00
|
|
|
- name: Setup build environment
|
2023-11-17 01:44:01 -05:00
|
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
|
2025-01-06 23:54:07 -05:00
|
|
|
- name: Setup Buildx
|
2024-03-20 07:29:16 -04:00
|
|
|
uses: docker/setup-buildx-action@v3.2.0
|
2023-11-17 01:44:01 -05:00
|
|
|
|
2025-01-06 23:54:07 -05:00
|
|
|
- name: Login to registry
|
2024-03-20 07:29:16 -04:00
|
|
|
uses: docker/login-action@v3.1.0
|
2023-11-17 01:44:01 -05:00
|
|
|
with:
|
|
|
|
registry: ${{ env.REGISTRY }}
|
|
|
|
username: ${{ github.actor }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
2025-01-06 23:54:07 -05:00
|
|
|
- name: Extract metadata
|
2023-11-17 01:44:01 -05:00
|
|
|
id: meta
|
2024-03-20 07:29:16 -04:00
|
|
|
uses: docker/metadata-action@v5.5.1
|
2023-11-17 01:44:01 -05:00
|
|
|
with:
|
|
|
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
2024-09-05 22:08:17 -04:00
|
|
|
|
2023-11-17 01:44:01 -05:00
|
|
|
- name: Get version
|
|
|
|
id: get_version
|
|
|
|
run: echo "version=$(git describe --tags --always)" >> $GITHUB_OUTPUT
|
|
|
|
|
2025-01-06 23:54:07 -05:00
|
|
|
- name: Build and push
|
2023-11-17 01:44:01 -05:00
|
|
|
id: build-and-push
|
2024-03-20 07:29:16 -04:00
|
|
|
uses: docker/build-push-action@v5.3.0
|
2023-11-17 01:44:01 -05:00
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
push: true
|
|
|
|
platforms: linux/amd64,linux/arm64
|
2025-01-06 23:54:07 -05:00
|
|
|
tags: |
|
|
|
|
${{ env.REGISTRY }}/${{ github.repository_owner }}/xboard:new
|
|
|
|
${{ env.REGISTRY }}/${{ github.repository_owner }}/xboard:${{ steps.get_version.outputs.version }}
|
|
|
|
|
|
|
|
- name: Sign image
|
2023-11-17 01:44:01 -05:00
|
|
|
env:
|
|
|
|
TAGS: ${{ steps.meta.outputs.tags }}
|
|
|
|
DIGEST: ${{ steps.build-and-push.outputs.digest }}
|
|
|
|
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}
|