This repository has been archived by the owner on Oct 4, 2023. It is now read-only.
CD #416
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: CD | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- Dockerfile | |
- .github/workflows/cd.yml | |
schedule: | |
- cron: '0 6 * * *' | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
GHCR_REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
build-and-push-image: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: co infuser | |
uses: actions/checkout@v3 | |
- name: Login to GHCR | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.GHCR_REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- uses: docker/metadata-action@v4 | |
id: meta | |
with: | |
images: ${{ env.GHCR_REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: | | |
type=raw,value=latest,enable={{is_default_branch}} | |
type=ref,event=branch,prefix= | |
type=schedule,enable=${{ github.event_name == 'schedule' && 'true' || 'false' }},pattern={{date 'YYYYMMDD'}},prefix=nightly- | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: docker buildx | |
run: | | |
for x in $(echo "${{ steps.meta.outputs.tags}}" | tr '\n' ' '); do tags="$tags --tag $x"; done | |
docker buildx build \ | |
--push \ | |
$tags \ | |
--platform linux/amd64,linux/arm64 \ | |
--file Dockerfile \ | |
. |