glider/.github/workflows/docker.yml

66 lines
1.6 KiB
YAML
Raw Normal View History

# https://github.com/docker/build-push-action#usage
name: Docker
2022-01-10 20:09:26 +08:00
on:
push:
branches:
2022-01-10 20:09:26 +08:00
- 'dev'
tags:
- '*'
2022-01-10 20:09:26 +08:00
env:
DOCKERHUB_REPO: nadoo/glider
GHCR_REPO: ghcr.io/nadoo/glider
2022-01-26 22:31:56 +08:00
PLATFORMS: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64
2022-01-10 20:09:26 +08:00
jobs:
publish:
name: Publish
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
2022-01-10 20:09:26 +08:00
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
2022-01-10 20:09:26 +08:00
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
2022-01-10 20:09:26 +08:00
- name: Login to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
2022-01-10 20:09:26 +08:00
password: ${{ secrets.GITHUB_TOKEN }}
2022-01-10 20:09:26 +08:00
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
2022-01-10 20:09:26 +08:00
images: |
${{ env.DOCKERHUB_REPO }}
${{ env.GHCR_REPO }}
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
2022-01-10 20:09:26 +08:00
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
2022-01-10 20:09:26 +08:00
platforms: ${{ env.PLATFORMS }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}