forked from dahlia/hollo
-
Notifications
You must be signed in to change notification settings - Fork 0
165 lines (159 loc) · 5.51 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
name: build
on:
push:
branches:
- main
- stable
tags: "*.*.*"
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- run: bun install
- run: bun check
- if: github.ref_type == 'tag'
run: |
set -ex
[[ "$(jq -r .version package.json)" = "$GITHUB_REF_NAME" ]]
! grep -i "to be released" CHANGES.md
build-image:
needs: [check]
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
platforms: linux/amd64, linux/arm64
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 }}:canary
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://docs.hollo.social/
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 }}:canary
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://docs.hollo.social/
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
release:
needs: [check]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- id: extract-changelog
uses: dahlia/submark@5a5ff0a58382fb812616a5801402f5aef00f90ce
with:
input-file: CHANGES.md
heading-level: 2
heading-title-text: version ${{ github.ref_name }}
ignore-case: true
omit-heading: true
- run: 'cat "$CHANGES_FILE"'
env:
CHANGES_FILE: ${{ steps.extract-changelog.outputs.output-file }}
- if: github.event_name == 'push' && github.ref_type == 'tag'
uses: softprops/action-gh-release@v1
with:
body_path: ${{ steps.extract-changelog.outputs.output-file }}
name: Hollo ${{ github.ref_name }}
generate_release_notes: false
publish-docs:
if: |
github.event_name == 'push' &&
(github.ref == 'refs/heads/main' || github.ref_type == 'tag')
runs-on: ubuntu-latest
permissions:
id-token: write
pages: write
deployments: write
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- run: |
bun install
bun run build
env:
PLAUSIBLE_DOMAIN: ${{ vars.PLAUSIBLE_DOMAIN }}
working-directory: ${{ github.workspace }}/docs/
- uses: actions/upload-pages-artifact@v3
with:
path: docs/dist
- if: github.ref_type == 'branch'
uses: nwtgck/[email protected]
with:
publish-dir: docs/dist
production-branch: main
github-token: ${{ github.token }}
enable-pull-request-comment: false
enable-commit-comment: false
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
timeout-minutes: 2
- if: github.ref_type == 'tag'
uses: actions/deploy-pages@v4
# cSpell: ignore buildx sergeysova