2020-11-12 23:39:54 +08:00
|
|
|
# https://github.com/docker/build-push-action#usage
|
2020-11-12 22:08:02 +08:00
|
|
|
name: Docker
|
2022-01-10 20:09:26 +08:00
|
|
|
|
2020-11-12 22:08:02 +08:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
2022-01-10 20:09:26 +08:00
|
|
|
- 'dev'
|
2020-11-12 22:08:02 +08:00
|
|
|
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
|
|
|
|
2020-11-12 22:08:02 +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'
|
2020-11-12 22:08:02 +08:00
|
|
|
uses: docker/login-action@v1
|
|
|
|
with:
|
2022-01-10 20:09:26 +08:00
|
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
2020-11-12 22:08:02 +08:00
|
|
|
|
2022-01-10 20:09:26 +08:00
|
|
|
- name: Login to GHCR
|
|
|
|
if: github.event_name != 'pull_request'
|
|
|
|
uses: docker/login-action@v1
|
2020-11-12 23:39:54 +08:00
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.repository_owner }}
|
2022-01-10 20:09:26 +08:00
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
2020-11-12 22:08:02 +08:00
|
|
|
|
2022-01-10 20:09:26 +08:00
|
|
|
- name: Docker meta
|
|
|
|
id: meta
|
|
|
|
uses: docker/metadata-action@v3
|
2020-11-12 22:08:02 +08:00
|
|
|
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}}
|
2020-11-12 22:08:02 +08:00
|
|
|
|
2022-01-10 20:09:26 +08:00
|
|
|
- name: Build and push
|
2020-11-12 22:08:02 +08:00
|
|
|
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 }}
|
2022-01-27 17:15:04 +08:00
|
|
|
cache-from: type=gha
|
|
|
|
cache-to: type=gha,mode=max
|