mirror of
https://github.com/nadoo/glider.git
synced 2025-02-23 01:15:41 +08:00
docker: publish to github container registry
This commit is contained in:
parent
678e9b9845
commit
da1075116f
20
.github/workflows/docker.yml
vendored
20
.github/workflows/docker.yml
vendored
@ -1,3 +1,5 @@
|
||||
# https://github.com/docker/build-push-action#usage
|
||||
|
||||
name: Docker
|
||||
on:
|
||||
push:
|
||||
@ -38,6 +40,13 @@ jobs:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build dev branch and push
|
||||
if: github.ref == 'refs/heads/dev'
|
||||
uses: docker/build-push-action@v2
|
||||
@ -45,7 +54,9 @@ jobs:
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
||||
push: true
|
||||
tags: 'nadoo/glider:dev'
|
||||
tags: 'nadoo/glider:dev,ghcr.io/nadoo/glider:dev'
|
||||
cache-from: type=local,src=/tmp/.buildx-cache
|
||||
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache
|
||||
|
||||
- name: Get all docker tags
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
@ -53,9 +64,12 @@ jobs:
|
||||
id: tags
|
||||
with:
|
||||
script: |
|
||||
const ref = `${context.payload.ref.replace(/\/?refs\/tags\//, '')}`
|
||||
const tags = [
|
||||
'nadoo/glider:latest',
|
||||
`nadoo/glider:${context.payload.ref.replace(/\/?refs\/tags\//, '')}`
|
||||
`nadoo/glider:${ref}`,
|
||||
'ghcr.io/nadoo/glider:latest',
|
||||
`ghcr.io/nadoo/glider:${ref}`
|
||||
]
|
||||
return tags.join(',')
|
||||
result-encoding: string
|
||||
@ -68,3 +82,5 @@ jobs:
|
||||
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
||||
push: true
|
||||
tags: ${{steps.tags.outputs.result}}
|
||||
cache-from: type=local,src=/tmp/.buildx-cache
|
||||
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache
|
||||
|
Loading…
Reference in New Issue
Block a user