-
Notifications
You must be signed in to change notification settings - Fork 15
82 lines (79 loc) · 3.13 KB
/
build.yaml
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: build
on:
push:
branches:
- main
jobs:
build-image:
permissions:
contents: read
packages: write
attestations: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- uses: sergeysova/jq-action@v2
id: version
with:
cmd: 'jq -r .version package.json'
- if: github.ref_type == 'tag'
run: '[[ "$VERSION" = "$GITHUB_REF_NAME" ]]'
env:
VERSION: ${{ steps.version.outputs.value }}
- if: github.ref_type != 'tag'
uses: docker/build-push-action@v5
with:
push: true
build-args:
VERSION=${{ steps.version.outputs.value }}-dev.${{ github.run_number }}
tags: |
ghcr.io/${{ github.repository }}:git-${{ github.sha }}
ghcr.io/${{ github.repository }}:${{ steps.version.outputs.value }}-dev.${{ github.run_number }}
ghcr.io/${{ github.repository }}:latest
labels:
org.opencontainers.image.revision=${{ github.sha }}
annotations:
org.opencontainers.image.title=Hollo
org.opencontainers.image.description=Federated single-user microblogging software
org.opencontainers.image.url=https://github.com/dahlia/hollo
org.opencontainers.image.source=https://github.com/dahlia/hollo
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.licenses=AGPL-3.0-only
org.opencontainers.image.version=${{ steps.version.outputs.value }}-dev.${{ github.run_number }}
cache-from:
type=registry,ref=ghcr.io/${{ github.repository }}:build-cache
cache-to:
type=registry,ref=ghcr.io/${{ github.repository }}:build-cache,mode=max
- if: github.ref_type == 'tag'
uses: docker/build-push-action@v5
with:
push: true
platforms: linux/amd64,linux/arm64
build-args:
VERSION=${{ steps.version.outputs.value }}
tags: |
ghcr.io/${{ github.repository }}:git-${{ github.sha }}
ghcr.io/${{ github.repository }}:${{ steps.version.outputs.value }}
ghcr.io/${{ github.repository }}:latest
labels:
org.opencontainers.image.revision=${{ github.sha }}
annotations:
org.opencontainers.image.title=Hollo
org.opencontainers.image.description=Federated single-user microblogging software
org.opencontainers.image.url=https://github.com/dahlia/hollo
org.opencontainers.image.source=https://github.com/dahlia/hollo
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.licenses=AGPL-3.0-only
org.opencontainers.image.version=${{ steps.version.outputs.value }}
cache-from:
type=registry,ref=ghcr.io/${{ github.repository }}:build-cache
cache-to:
type=registry,ref=ghcr.io/${{ github.repository }}:build-cache,mode=max
# cSpell: ignore buildx sergeysova