-
Notifications
You must be signed in to change notification settings - Fork 96
59 lines (55 loc) · 1.65 KB
/
docker_image.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
on:
release:
types:
- published
push:
branches:
- main
pull_request:
types:
- opened
- synchronize
- reopened
branches-ignore:
- "dependabot/**"
name: "Docker Image"
jobs:
docker:
name: "Publish to Docker"
runs-on: ubuntu-latest
env:
PLATFORMS: "${{ github.event_name == 'release' && 'linux/amd64,linux/arm64,linux/arm/v7' || 'linux/amd64' }}"
VERSION: "${{ github.event_name == 'release' && github.event.release.name || github.ref_name }}"
steps:
- uses: actions/checkout@v3
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- uses: docker/login-action@v2
id: login
env:
token_is_present: "${{ secrets.DOCKERHUB_TOKEN && true }}"
if: ${{ env.token_is_present }}
with:
username: ${{ secrets.DOCKERHUB_USERNAME || 'benbjohnson' }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- id: meta
uses: docker/metadata-action@v4
with:
images: flyio/litefs
tags: |
type=ref,event=branch
type=ref,event=pr
type=sha
type=sha,format=long
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- uses: docker/build-push-action@v4
with:
context: .
push: ${{ steps.login.outcome != 'skipped' }}
platforms: ${{ env.PLATFORMS }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
LITEFS_VERSION=${{ env.VERSION }}
LITEFS_COMMIT=${{ github.sha }}