-
Notifications
You must be signed in to change notification settings - Fork 0
95 lines (82 loc) · 2.89 KB
/
Copy pathrelease.yml
File metadata and controls
95 lines (82 loc) · 2.89 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
name: Release
on:
push:
tags:
- "v*"
env:
REGISTRY: ghcr.io
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Extract version from tag
id: version
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT
- name: Set image names
run: |
REPO_LC="${REPO,,}"
echo "API_IMAGE=ghcr.io/${REPO_LC}/api" >> $GITHUB_ENV
echo "WEB_IMAGE=ghcr.io/${REPO_LC}/web" >> $GITHUB_ENV
env:
REPO: ${{ github.repository }}
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push API image
uses: docker/build-push-action@v6
with:
context: apps/api
push: true
tags: |
${{ env.API_IMAGE }}:${{ steps.version.outputs.VERSION }}
${{ env.API_IMAGE }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build and push Web image
uses: docker/build-push-action@v6
with:
context: apps/web
push: true
build-args: |
DEQUEL_VERSION=${{ steps.version.outputs.VERSION }}
tags: |
${{ env.WEB_IMAGE }}:${{ steps.version.outputs.VERSION }}
${{ env.WEB_IMAGE }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build config tarball
run: |
VERSION="${{ steps.version.outputs.VERSION }}"
TAR_DIR=_tar
mkdir -p "$TAR_DIR/infra/caddy" "$TAR_DIR/infra/monitoring/grafana/datasources"
cp docker-compose.yml "$TAR_DIR/"
cp scripts/dequel "$TAR_DIR/dequel"
cp infra/caddy/Caddyfile "$TAR_DIR/infra/caddy/"
cp -r infra/monitoring "$TAR_DIR/infra/"
cd "$TAR_DIR" && tar -czf "../dequel-config-${VERSION}.tar.gz" .
- name: Extract changelog entry for this version
run: |
VERSION="${{ steps.version.outputs.VERSION }}"
awk '/^## \['"$VERSION"'\] -/{flag=1; next} /^## \[/{if(flag) exit} flag' CHANGELOG.md > release-notes.md
if [ ! -s release-notes.md ]; then
echo "No changelog entry for v$VERSION, will use auto-generated notes"
fi
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
name: v${{ steps.version.outputs.VERSION }}
body_path: release-notes.md
generate_release_notes: true
files: |
scripts/install.sh
dequel-config-${{ steps.version.outputs.VERSION }}.tar.gz