mirror of
https://github.com/nadoo/glider.git
synced 2025-02-23 17:35:40 +08:00
71 lines
1.8 KiB
YAML
71 lines
1.8 KiB
YAML
![]() |
name: Docker
|
||
|
on:
|
||
|
push:
|
||
|
branches:
|
||
|
- dev
|
||
|
tags:
|
||
|
- '*'
|
||
|
|
||
|
jobs:
|
||
|
publish:
|
||
|
name: Publish
|
||
|
runs-on: ubuntu-latest
|
||
|
steps:
|
||
|
- name: Checkout
|
||
|
uses: actions/checkout@v2
|
||
|
with:
|
||
|
fetch-depth: 0
|
||
|
|
||
|
- name: Set up QEMU
|
||
|
uses: docker/setup-qemu-action@v1
|
||
|
|
||
|
- name: Set up Docker Buildx
|
||
|
uses: docker/setup-buildx-action@v1
|
||
|
with:
|
||
|
buildkitd-flags: "--debug"
|
||
|
|
||
|
- 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.DOCKER_USERNAME }}
|
||
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||
|
|
||
|
- name: Build dev branch and push
|
||
|
if: github.ref == 'refs/heads/dev'
|
||
|
uses: docker/build-push-action@v2
|
||
|
with:
|
||
|
context: .
|
||
|
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
||
|
push: true
|
||
|
tags: 'nadoo/glider:dev'
|
||
|
|
||
|
- name: Get all docker tags
|
||
|
if: startsWith(github.ref, 'refs/tags/')
|
||
|
uses: actions/github-script@v3
|
||
|
id: tags
|
||
|
with:
|
||
|
script: |
|
||
|
const tags = [
|
||
|
'nadoo/glider:latest',
|
||
|
`nadoo/glider:${context.payload.ref.replace(/\/?refs\/tags\//, '')}`
|
||
|
]
|
||
|
return tags.join(',')
|
||
|
result-encoding: string
|
||
|
|
||
|
- name: Build release and push
|
||
|
if: startsWith(github.ref, 'refs/tags/')
|
||
|
uses: docker/build-push-action@v2
|
||
|
with:
|
||
|
context: .
|
||
|
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
||
|
push: true
|
||
|
tags: ${{steps.tags.outputs.result}}
|