ci(docker): Publish Docker Image on Release

This commit is contained in:
Steven Tang 2021-02-03 19:41:11 +11:00
parent 8bed266110
commit 8ceef42ad4
No known key found for this signature in database
GPG Key ID: AA0C5A4496B7ADF5
3 changed files with 46 additions and 2 deletions

42
.github/workflows/docker.yml vendored Normal file
View File

@ -0,0 +1,42 @@
name: Publish Docker Image
on:
push:
tags:
- '*.*.*'
- '!*.*.*-*'
jobs:
docker-publish:
runs-on: ubuntu-latest
steps:
# https://stackoverflow.com/questions/58177786
- name: Get version
run: echo "GIT_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push to Docker Hub
uses: docker/build-push-action@v2
with:
push: true
tags: |
n1try/wakapi:${{ env.GIT_TAG }}
n1try/wakapi:latest
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache

View File

@ -2,10 +2,11 @@ name: Build Wakapi on Linux
on:
push:
branches:
pull_request:
release:
types:
- created
- published
jobs:
build-and-release:

View File

@ -2,10 +2,11 @@ name: Build Wakapi on Windows
on:
push:
branches:
pull_request:
release:
types:
- created
- published
jobs:
build-and-release: