mirror of
https://github.com/nadoo/glider.git
synced 2025-02-23 09:25: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
|
name: Docker
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@ -38,6 +40,13 @@ jobs:
|
|||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
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
|
- name: Build dev branch and push
|
||||||
if: github.ref == 'refs/heads/dev'
|
if: github.ref == 'refs/heads/dev'
|
||||||
uses: docker/build-push-action@v2
|
uses: docker/build-push-action@v2
|
||||||
@ -45,7 +54,9 @@ jobs:
|
|||||||
context: .
|
context: .
|
||||||
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
||||||
push: true
|
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
|
- name: Get all docker tags
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
@ -53,9 +64,12 @@ jobs:
|
|||||||
id: tags
|
id: tags
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
|
const ref = `${context.payload.ref.replace(/\/?refs\/tags\//, '')}`
|
||||||
const tags = [
|
const tags = [
|
||||||
'nadoo/glider:latest',
|
'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(',')
|
return tags.join(',')
|
||||||
result-encoding: string
|
result-encoding: string
|
||||||
@ -68,3 +82,5 @@ jobs:
|
|||||||
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
||||||
push: true
|
push: true
|
||||||
tags: ${{steps.tags.outputs.result}}
|
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