-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (91 loc) · 3.31 KB
/
Copy pathrelease.yml
File metadata and controls
102 lines (91 loc) · 3.31 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
name: Release
on:
push:
branches: [main, master]
paths:
- VERSION
workflow_dispatch:
permissions:
contents: write
packages: write
concurrency:
group: release
cancel-in-progress: false
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout full history
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Read and validate version
id: version
shell: bash
run: |
version="$(tr -d '[:space:]' < VERSION)"
if [[ ! "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$ ]]; then
echo "VERSION must contain a valid semantic version" >&2
exit 1
fi
echo "version=$version" >> "$GITHUB_OUTPUT"
echo "tag=v$version" >> "$GITHUB_OUTPUT"
echo "image=ghcr.io/${GITHUB_REPOSITORY,,}" >> "$GITHUB_OUTPUT"
if git rev-parse "refs/tags/v$version" >/dev/null 2>&1; then
echo "publish=false" >> "$GITHUB_OUTPUT"
echo "v$version already exists; nothing to publish"
else
echo "publish=true" >> "$GITHUB_OUTPUT"
fi
- name: Set up Python
if: steps.version.outputs.publish == 'true'
uses: actions/setup-python@v6
with:
python-version: "3.11"
- name: Run release checks
if: steps.version.outputs.publish == 'true'
run: |
python -m unittest discover -s tests -v
python -m py_compile app/cookie_keepalive.py app/media_store.py app/recorder.py app/server.py app/scheduler.py app/tls_server.py app/zoom_auth.py
node --check app/static/app.js
cp .env.example .env
docker compose config --quiet
- name: Set up Docker Buildx
if: steps.version.outputs.publish == 'true'
uses: docker/setup-buildx-action@v4
- name: Log in to GitHub Container Registry
if: steps.version.outputs.publish == 'true'
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and publish image
if: steps.version.outputs.publish == 'true'
uses: docker/build-push-action@v7
with:
context: .
file: app/Dockerfile
push: true
tags: |
${{ steps.version.outputs.image }}:${{ steps.version.outputs.version }}
${{ steps.version.outputs.image }}:latest
labels: |
org.opencontainers.image.title=WebMeet Recorder
org.opencontainers.image.version=${{ steps.version.outputs.version }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
provenance: true
sbom: true
- name: Create GitHub Release
if: steps.version.outputs.publish == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ steps.version.outputs.version }}
TAG: ${{ steps.version.outputs.tag }}
run: |
gh release create "$TAG" \
--target "$GITHUB_SHA" \
--title "WebMeet Recorder $TAG" \
--generate-notes \
--notes "Container image: ghcr.io/${GITHUB_REPOSITORY,,}:$VERSION"