-
Notifications
You must be signed in to change notification settings - Fork 0
116 lines (101 loc) · 3.55 KB
/
Copy pathrelease.yml
File metadata and controls
116 lines (101 loc) · 3.55 KB
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
name: Release
# Two ways to cut a release:
# • push a SemVer tag (e.g. `v0.1.0`), or
# • run this workflow manually (Actions ▸ Release ▸ Run workflow) and pass the tag —
# the release job then creates that tag from the current branch for you.
#
# Either way it builds & pushes the API and Web container images to the GitHub Container
# Registry (linked to this repo via OCI source labels, so they appear under Packages),
# then publishes the GitHub Release with auto-generated notes.
on:
push:
tags: ['v*']
workflow_dispatch:
inputs:
tag:
description: Release tag (SemVer, e.g. v0.1.0)
required: true
default: v0.1.0
permissions:
contents: write # create the tag + GitHub Release
packages: write # push images to ghcr.io
jobs:
prep:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.ver.outputs.version }}
steps:
- id: ver
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
v="${{ inputs.tag }}"
else
v="${{ github.ref_name }}"
fi
echo "version=$v" >> "$GITHUB_OUTPUT"
images:
name: Publish ${{ matrix.name }} image
needs: prep
runs-on: ubuntu-latest
strategy:
matrix:
include:
- name: api
image: ghcr.io/softpython2884/opencoperlock-api
dockerfile: infra/Dockerfile.api
build_args: ''
- name: web
image: ghcr.io/softpython2884/opencoperlock-web
dockerfile: infra/Dockerfile.web
build_args: |
NEXT_PUBLIC_API_URL=http://localhost:4000
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build & push
uses: docker/build-push-action@v6
with:
context: .
file: ${{ matrix.dockerfile }}
push: true
tags: |
${{ matrix.image }}:${{ needs.prep.outputs.version }}
${{ matrix.image }}:latest
labels: |
org.opencontainers.image.source=https://github.com/softpython2884/OpenCoperLock
org.opencontainers.image.version=${{ needs.prep.outputs.version }}
org.opencontainers.image.licenses=AGPL-3.0-or-later
build-args: ${{ matrix.build_args }}
cache-from: type=gha
cache-to: type=gha,mode=max
release:
name: GitHub Release
needs: [prep, images]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Create release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.prep.outputs.version }}
name: OpenCoperLock ${{ needs.prep.outputs.version }}
generate_release_notes: true
body: |
## OpenCoperLock ${{ needs.prep.outputs.version }}
Self-hostable private cloud — a classic Drive plus advanced acquisition & security tooling.
### Container images
Published to the GitHub Container Registry:
```bash
docker pull ghcr.io/softpython2884/opencoperlock-api:${{ needs.prep.outputs.version }}
docker pull ghcr.io/softpython2884/opencoperlock-web:${{ needs.prep.outputs.version }}
```
See `infra/docker-compose.yml` and `docs/DEPLOYMENT.md` to deploy.
---