Repository navigation
138 lines (123 loc) · 5.11 KB
/
Copy pathrelease.yml
File metadata and controls
138 lines (123 loc) · 5.11 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
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 and release type
id: version
run: |
VERSION="${GITHUB_REF_NAME#v}"
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
if [[ "$VERSION" =~ [-] ]]; then
echo "IS_PRERELEASE=true" >> $GITHUB_OUTPUT
else
echo "IS_PRERELEASE=false" >> $GITHUB_OUTPUT
fi
- 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
echo "AGENT_IMAGE=ghcr.io/${REPO_LC}/agent" >> $GITHUB_ENV
echo "SANDBOX_IMAGE=ghcr.io/${REPO_LC}/sandbox" >> $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
build-args: |
BUILD_TIME=${{ github.sha }}
DEQUEL_POSTHOG_KEY=${{ secrets.DEQUEL_POSTHOG_KEY }}
tags: |
${{ env.API_IMAGE }}:${{ steps.version.outputs.VERSION }}
${{ steps.version.outputs.IS_PRERELEASE == 'false' && format('{0}:latest', env.API_IMAGE) || format('{0}:next', env.API_IMAGE) }}
cache-from: type=gha,scope=api-${{ github.sha }}
cache-to: type=gha,scope=api-${{ github.sha }},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 }}
BUILD_TIME=${{ github.sha }}
tags: |
${{ env.WEB_IMAGE }}:${{ steps.version.outputs.VERSION }}
${{ steps.version.outputs.IS_PRERELEASE == 'false' && format('{0}:latest', env.WEB_IMAGE) || format('{0}:next', env.WEB_IMAGE) }}
cache-from: type=gha,scope=web-${{ github.sha }}
cache-to: type=gha,scope=web-${{ github.sha }},mode=max
- name: Build and push Agent image
uses: docker/build-push-action@v6
with:
context: apps/agent
push: true
build-args: |
BUILD_TIME=${{ github.sha }}
tags: |
${{ env.AGENT_IMAGE }}:${{ steps.version.outputs.VERSION }}
${{ steps.version.outputs.IS_PRERELEASE == 'false' && format('{0}:latest', env.AGENT_IMAGE) || format('{0}:next', env.AGENT_IMAGE) }}
cache-from: type=gha,scope=agent-${{ github.sha }}
cache-to: type=gha,scope=agent-${{ github.sha }},mode=max
- name: Build and push diagnose sandbox image
uses: docker/build-push-action@v6
with:
context: apps/api
file: apps/api/Dockerfile.sandbox
push: true
tags: |
${{ env.SANDBOX_IMAGE }}:${{ steps.version.outputs.VERSION }}
${{ steps.version.outputs.IS_PRERELEASE == 'false' && format('{0}:latest', env.SANDBOX_IMAGE) || format('{0}:next', env.SANDBOX_IMAGE) }}
cache-from: type=gha,scope=sandbox-${{ github.sha }}
cache-to: type=gha,scope=sandbox-${{ github.sha }},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" "$TAR_DIR/scripts/auth"
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/"
cp -r scripts/auth/* "$TAR_DIR/scripts/auth/"
cd "$TAR_DIR" && tar -czf "../dequel-config-${VERSION}.tar.gz" .
- name: Extract changelog entry for this version
run: |
VERSION="${{ steps.version.outputs.VERSION }}"
CHANGELOG="apps/docs/src/content/changelogs/v${VERSION}.md"
if [ -f "$CHANGELOG" ]; then
sed '1,/^---$/d' "$CHANGELOG" | sed '1,/^---$/d' > release-notes.md
echo "Extracted changelog from $CHANGELOG"
else
echo "No changelog file at $CHANGELOG, will use auto-generated notes"
fi
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
name: v${{ steps.version.outputs.VERSION }}
prerelease: ${{ steps.version.outputs.IS_PRERELEASE == 'true' }}
body_path: release-notes.md
generate_release_notes: true
files: |
scripts/install.sh
dequel-config-${{ steps.version.outputs.VERSION }}.tar.gz