CI #21
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
schedule: | |
- cron: '55 9 * * 1' | |
permissions: | |
packages: write | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build Docker image | |
run: docker build -t knight/cloudflared-dns:dev . | |
- name: Install Goss | |
uses: e1himself/[email protected] | |
with: | |
version: 'v0.4.9' | |
- name: Execute Goss tests | |
env: | |
GOSS_FILES_STRATEGY: cp | |
run: dgoss run knight/cloudflared-dns:dev | |
deploy: | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Get current date | |
id: date | |
run: echo "::set-output name=date::$(date +'%Y-%m-%d')" | |
- name: Docker Login | |
uses: docker/[email protected] | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build and push latest | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: ./Dockerfile | |
platforms: | | |
linux/amd64 | |
linux/arm64 | |
linux/arm/v6 | |
linux/arm/v7 | |
linux/ppc64le | |
linux/s390x | |
linux/386 | |
linux/riscv64 | |
push: true | |
sbom: true | |
provenance: mode=max | |
tags: | | |
knight/cloudflared-dns:latest | |
knight/cloudflared-dns:${{ steps.date.outputs.date }} | |
ghcr.io/knight1/cloudflared:latest | |
ghcr.io/knight1/cloudflared:${{ steps.date.outputs.date }} | |
cache-from: type=registry,ref=knight/cloudflared-dns:buildcache | |
cache-to: type=registry,ref=knight/cloudflared-dns:buildcache,mode=max |