-
Notifications
You must be signed in to change notification settings - Fork 1
84 lines (78 loc) · 2.53 KB
/
release-please.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
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
on:
push:
branches:
- main
permissions:
contents: write
packages: write
pull-requests: write
id-token: write
name: release-please
jobs:
release-please:
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
steps:
- uses: googleapis/release-please-action@v4
id: release
with:
token: ${{ secrets.GITHUB_TOKEN }}
release-type: go
- run: echo "release_created=${{ steps.release.outputs.release_created }}" >> "$GITHUB_OUTPUT"
- run: echo "tag_name=${{ steps.release.outputs.tag_name }}" >> "$GITHUB_OUTPUT"
build-and-publish:
runs-on: ubuntu-latest
needs: release-please
if: ${{ needs.release-please.outputs.release_created }}
steps:
- name: Docker Image Metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/ptah-sh/ptah-caddy
tags: |
type=semver,pattern={{version}}
type=ref,event=pr
type=ref,event=tag
type=sha
type=edge
type=raw,priority=1001,value=${{ needs.release-please.outputs.tag_name }}
type=raw,value=latest
labels: |
org.opencontainers.image.licenses=FSL-1.1-Apache-2.0
annotations: |
org.opencontainers.image.licenses=FSL-1.1-Apache-2.0
- name: Login to Docker Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
annotations: ${{ steps.meta.outputs.annotations }}
labels: ${{ steps.meta.outputs.labels }}
# TODO: should we create a github deployment?
deploy:
runs-on: ubuntu-latest
needs:
- release-please
- build-and-publish
if: ${{ needs.release-please.outputs.release_created }}
steps:
- name: Deploy to Ptah.sh
uses: ptah-sh/[email protected]
with:
apiKey: ${{ secrets.PTAH_API_TOKEN }}
service: 'caddy'
processes: |
- name: svc
dockerImage: ghcr.io/ptah-sh/ptah-caddy:${{ needs.release-please.outputs.tag_name }}
envVars:
- name: SENTRY_RELEASE
value: ${{ needs.release-please.outputs.tag_name }}