clash/.github/workflows/docker.yaml

61 lines
1.6 KiB
YAML
Raw Normal View History

2022-04-28 06:11:35 +00:00
name: Docker
2022-05-01 16:59:41 +00:00
on:
push:
branches:
- Beta
tags:
- "v*"
2022-04-28 06:11:35 +00:00
env:
REGISTRY: docker.io
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v1
2022-05-01 16:59:41 +00:00
with:
version: latest
2022-04-28 06:11:35 +00:00
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v3
with:
2022-05-01 16:59:41 +00:00
images: ${{ env.REGISTRY }}/${{ secrets.DOCKERHUB_ACCOUNT }}/${{secrets.DOCKERHUB_REPO}}
2022-04-28 06:11:35 +00:00
2022-05-01 16:59:41 +00:00
- name: Log into registry
2022-04-28 06:11:35 +00:00
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
2022-05-01 16:59:41 +00:00
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
2022-04-28 06:11:35 +00:00
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v2
with:
context: .
2022-05-01 16:59:41 +00:00
file: ./Dockerfile
2022-04-28 06:11:35 +00:00
push: ${{ github.event_name != 'pull_request' }}
platforms: |
linux/386
linux/amd64
linux/arm64/v8
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}