Skip to content

CI

CI #100

Workflow file for this run

name: CI
concurrency:
group: ci-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
on:
push:
branches:
- master
pull_request:
schedule:
- cron: "0 10 * * *" # ~2am PST
workflow_dispatch:
inputs:
debug_enabled:
type: boolean
description: "Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)"
required: false
default: false
env:
REGISTRY: ghcr.io
ORG: githedgehog
jobs:
dockers:
runs-on: lab
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
# - name: Set up QEMU
# uses: docker/setup-qemu-action@v2
- name: Set up Docker Context for Buildx
id: buildx-context
run: |
docker context create builders
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
endpoint: builders
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.ORG }}/toolbox
tags: |
type=ref,event=pr
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push (on master only) Docker image
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile
platforms: linux/amd64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Oras push for hhfab
id: oras
run: |
docker pull ghcr.io/githedgehog/toolbox:latest
docker save -o toolbox.tar ghcr.io/githedgehog/toolbox:latest
oras push ghcr.io/githedgehog/fabricator/toolbox:latest toolbox.tar
- name: Setup tmate session for debug
if: ${{ failure() && github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
uses: mxschmitt/action-tmate@v3
timeout-minutes: 30
with:
limit-access-to-actor: true
dockers-results:
name: Docker Build/Publish Results
needs:
- dockers
if: ${{ always() }}
runs-on: lab
steps:
- run: |
result="${{ needs.dockers.result }}"
if [[ $result == "success" || $result == "skipped" ]]; then
exit 0
else
exit 1
fi