mirror of
https://github.com/yanhao98/docker-example.git
synced 2025-07-13 04:00:47 +08:00
62 lines
1.7 KiB
YAML
62 lines
1.7 KiB
YAML
# https://gitea.com/gitea/act_runner/src/commit/0e2a3e00f5b32d5407f4f929a1ae61d3df825362/.gitea/workflows/release-nightly.yml
|
|
name: Release Nightly
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
tags:
|
|
- "*"
|
|
|
|
env:
|
|
GHCR_IMAGE_NAME: ${{ github.repository }}
|
|
GHCR_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
GHCR_USERNAME: ${{ github.repository_owner }}
|
|
DOCKER_LATEST: nightly
|
|
|
|
jobs:
|
|
docker:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Login to GHCR
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ env.GHCR_USERNAME }}
|
|
password: ${{ env.GHCR_TOKEN }}
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Extract metadata
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: |
|
|
ghcr.io/${{ env.GHCR_IMAGE_NAME }}
|
|
tags: |
|
|
type=raw,value=${{ env.DOCKER_LATEST }}
|
|
type=semver,pattern={{major}}
|
|
type=raw,value=dev,enable=${{ github.ref == 'refs/heads/dev' }}
|
|
|
|
- name: Print metadata
|
|
run: |
|
|
echo "tags: ${{ steps.meta.outputs.tags }}"
|
|
echo "labels: ${{ steps.meta.outputs.labels }}"
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
platforms: linux/amd64,linux/arm64
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
file: ./Dockerfile
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max |