2021-05-24 00:25:48 +08:00
|
|
|
name: Deploy
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2021-11-16 12:53:32 +08:00
|
|
|
tags: ["v*"]
|
2021-05-24 00:25:48 +08:00
|
|
|
branches: [ main ]
|
|
|
|
|
2021-11-16 12:53:32 +08:00
|
|
|
env:
|
|
|
|
REGISTRY: ghcr.io
|
|
|
|
IMAGE_NAME: ${{ github.repository }}
|
|
|
|
|
2021-05-24 00:25:48 +08:00
|
|
|
jobs:
|
|
|
|
|
|
|
|
publish:
|
|
|
|
name: Publish
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Set up QEMU
|
|
|
|
uses: docker/setup-qemu-action@v1
|
|
|
|
|
|
|
|
- name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v1
|
|
|
|
|
|
|
|
- name: Docker Login
|
2021-11-16 12:53:32 +08:00
|
|
|
uses: docker/login-action@v1
|
|
|
|
with:
|
|
|
|
registry: ${{ env.REGISTRY }}
|
|
|
|
username: ${{ github.actor }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
|
|
|
- name: Generate Docker tags
|
|
|
|
uses: docker/metadata-action@v3
|
2021-05-24 00:25:48 +08:00
|
|
|
with:
|
2021-11-16 12:53:32 +08:00
|
|
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
2021-11-16 21:47:03 +08:00
|
|
|
tags: |
|
|
|
|
type=ref,event=branch
|
|
|
|
type=ref,event=pr
|
|
|
|
type=semver,pattern={{version}}
|
|
|
|
type=semver,pattern={{major}}.{{minor}}
|
2021-11-16 12:53:32 +08:00
|
|
|
id: meta
|
2021-05-24 00:25:48 +08:00
|
|
|
|
|
|
|
- name: Build and push Docker images
|
2021-11-16 12:53:32 +08:00
|
|
|
uses: docker/build-push-action@v2
|
2021-05-24 00:25:48 +08:00
|
|
|
with:
|
|
|
|
pull: true
|
|
|
|
platforms: linux/amd64
|
|
|
|
push: true
|
2021-11-16 12:53:32 +08:00
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|
2021-05-24 00:25:48 +08:00
|
|
|
|
|
|
|
|
|
|
|
# vim: set et ts=2 sw=2:
|