push to ghcr

This commit is contained in:
BennyThink 2021-12-26 18:49:47 +08:00
parent 48fe83b6b8
commit 5f19a51a9b
No known key found for this signature in database
GPG key ID: 6CD0DBDA5235D481

View file

@ -1,3 +1,4 @@
name: docker image builder
on:
push:
branches:
@ -32,19 +33,35 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Lower case
id: string
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Lower case for Docker Hub
id: dh_string
uses: ASzc/change-string-case-action@v1
with:
string: ${{ secrets.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }}
- name: Lower case for ghcr
id: ghcr_string
uses: ASzc/change-string-case-action@v1
with:
string: ${{ github.event.repository.full_name }}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/arm,linux/amd64,linux/arm64
push: true
tags: ${{ steps.string.outputs.lowercase }}
tags: |
${{ steps.dh_string.outputs.lowercase }}
ghcr.io/${{ steps.ghcr_string.outputs.lowercase }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max