Skip to content

Commit f46a763

Browse files
ci: tidy up workflows and implement a consistent style (seerr-team#1905)
* feat(ci): tidy up workflows and implement a consistent style all workflows now use ubuntu-24.04 as the runner type to match the release workflows codeql.yml - bump actions to v3 - add least-privilege perms + concurrency to stop duplicate runs - ignore docs only changes conflict_labeler.yml - run on opened, reopened, and synchronize - bump action version - add concurrency group to avoid duplicate labeling cypress.yml - skip docs-only changes; don’t run on draft PRs - add concurrency to stop duplicate runs + 10m timeout docs-deploy.yml - add configure-pages@v5 and bump upload-pages-artifact to v4 - set explicit pages/id-token perms + concurrency - minor cleanups (working-directory, ubuntu-24.04) helm.yml - switch oras discover to oras manifest fetch - add concurrency to stop duplicate runs lint-helm-charts.yml - bump action versions - enforce version bumps (--check-version-increment=true) - add least-privilege perms + concurrency to stop duplicate runs support.yml - add least-privilege perms test-docs-deploy.yml - add least-privilege perms + concurrency to stop duplicate runs * fixed line 5 syntax error * Updated based on comments from @M0NsTeRRR in PR-1905 discussion * updated based on 2nd review from @M0NsTeRRR in PR-1905 * Merge of PR-1904 and PR-1905 * chore(pnpm-lock.yaml): updated the pnpm-lockfile * ci(release.yml): fix the latest tag to use context labels * ci: fix new lines at eof, removed cypress timeout, removed legacy qemu actions * @M0NsTeRRR self review Signed-off-by: Ludovic Ortega <[email protected]> * fix: support workflow Signed-off-by: Ludovic Ortega <[email protected]> * fix: newline --------- Signed-off-by: Ludovic Ortega <[email protected]> Co-authored-by: Ludovic Ortega <[email protected]> Co-authored-by: Ludovic Ortega <[email protected]>
1 parent c024799 commit f46a763

File tree

16 files changed

+568
-1720
lines changed

16 files changed

+568
-1720
lines changed

.github/workflows/ci.yml

Lines changed: 92 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ on:
77
push:
88
branches:
99
- develop
10+
workflow_dispatch:
11+
12+
permissions:
13+
contents: read
14+
15+
concurrency:
16+
group: ci-${{ github.ref }}
17+
cancel-in-progress: true
1018

1119
jobs:
1220
test:
@@ -17,152 +25,169 @@ jobs:
1725
steps:
1826
- name: Checkout
1927
uses: actions/checkout@v4
28+
with:
29+
persist-credentials: false
30+
31+
- name: Get PNPM version from package.json
32+
id: pnpm-version
33+
shell: sh
34+
run: echo "pnpm_version=$(node -p 'require(`./package.json`).packageManager.split(\"@\")[1]')" >> $GITHUB_OUTPUT
35+
2036
- name: Pnpm Setup
2137
uses: pnpm/action-setup@v4
2238
with:
23-
version: 9
39+
version: ${{ steps.pnpm-version.outputs.pnpm_version }}
40+
2441
- name: Get pnpm store directory
2542
shell: sh
2643
run: |
2744
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
45+
2846
- name: Setup pnpm cache
2947
uses: actions/cache@v4
3048
with:
3149
path: ${{ env.STORE_PATH }}
3250
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
3351
restore-keys: |
3452
${{ runner.os }}-pnpm-store-
53+
3554
- name: Install dependencies
3655
env:
3756
HUSKY: 0
3857
run: pnpm install
58+
3959
- name: Lint
4060
run: pnpm lint
61+
4162
- name: Formatting
4263
run: pnpm format:check
64+
4365
- name: Build
4466
run: pnpm build
4567

4668
build:
47-
name: Build & Publish Docker Images
69+
name: Build (per-arch, native runners)
4870
if: github.ref == 'refs/heads/develop' && !contains(github.event.head_commit.message, '[skip ci]')
4971
strategy:
5072
matrix:
5173
include:
5274
- runner: ubuntu-24.04
5375
platform: linux/amd64
76+
arch: amd64
5477
- runner: ubuntu-24.04-arm
5578
platform: linux/arm64
79+
arch: arm64
5680
runs-on: ${{ matrix.runner }}
57-
outputs:
58-
digest-amd64: ${{ steps.set_outputs.outputs.digest-amd64 }}
59-
digest-arm64: ${{ steps.set_outputs.outputs.digest-arm64 }}
6081
steps:
6182
- name: Checkout
6283
uses: actions/checkout@v4
84+
with:
85+
persist-credentials: false
86+
87+
- name: Commit timestamp
88+
id: ts
89+
run: echo "TIMESTAMP=$(git log -1 --pretty=%ct)" >> "$GITHUB_OUTPUT"
90+
6391
- name: Set up Docker Buildx
6492
uses: docker/setup-buildx-action@v3
65-
- name: Log in to Docker Hub
66-
uses: docker/login-action@v3
67-
with:
68-
username: ${{ secrets.DOCKER_USERNAME }}
69-
password: ${{ secrets.DOCKER_TOKEN }}
70-
- name: Log in to GitHub Container Registry
71-
uses: docker/login-action@v3
72-
with:
73-
registry: ghcr.io
74-
username: ${{ github.repository_owner }}
75-
password: ${{ secrets.GITHUB_TOKEN }}
76-
- name: Set lower case owner name
77-
run: |
78-
echo "OWNER_LC=${OWNER,,}" >>${GITHUB_ENV}
79-
env:
80-
OWNER: ${{ github.repository_owner }}
81-
- name: Docker metadata
82-
id: meta
83-
uses: docker/metadata-action@v4
84-
with:
85-
images: |
86-
fallenbagel/jellyseerr
87-
ghcr.io/${{ env.OWNER_LC }}/jellyseerr
88-
tags: |
89-
type=ref,event=branch
90-
type=sha,prefix=,suffix=,format=short
91-
- name: Build and push by digest
92-
id: build
93-
uses: docker/build-push-action@v5
93+
94+
- name: Warm cache (no push) — ${{ matrix.platform }}
95+
uses: docker/build-push-action@v6
9496
with:
9597
context: .
9698
file: ./Dockerfile
9799
platforms: ${{ matrix.platform }}
98-
push: true
100+
push: false
99101
build-args: |
100102
COMMIT_TAG=${{ github.sha }}
101103
BUILD_VERSION=develop
102-
BUILD_DATE=${{ github.event.repository.updated_at }}
103-
outputs: |
104-
type=image,push-by-digest=true,name=fallenbagel/jellyseerr,push=true
105-
type=image,push-by-digest=true,name=ghcr.io/${{ env.OWNER_LC }}/jellyseerr,push=true
104+
SOURCE_DATE_EPOCH=${{ steps.ts.outputs.TIMESTAMP }}
106105
cache-from: type=gha,scope=${{ matrix.platform }}
107106
cache-to: type=gha,mode=max,scope=${{ matrix.platform }}
108107
provenance: false
109-
- name: Set outputs
110-
id: set_outputs
111-
run: |
112-
platform="${{ matrix.platform == 'linux/amd64' && 'amd64' || 'arm64' }}"
113-
echo "digest-${platform}=${{ steps.build.outputs.digest }}" >> $GITHUB_OUTPUT
114108

115-
merge_and_push:
116-
name: Create and Push Multi-arch Manifest
109+
publish:
110+
name: Publish multi-arch image
117111
needs: build
118112
runs-on: ubuntu-24.04
113+
permissions:
114+
contents: read
115+
packages: write
116+
id-token: write
119117
steps:
118+
- name: Checkout
119+
uses: actions/checkout@v4
120+
with:
121+
persist-credentials: false
122+
123+
- name: Commit timestamp
124+
id: ts
125+
run: echo "TIMESTAMP=$(git log -1 --pretty=%ct)" >> "$GITHUB_OUTPUT"
126+
127+
- name: Set up Docker Buildx
128+
uses: docker/setup-buildx-action@v3
129+
120130
- name: Log in to Docker Hub
121131
uses: docker/login-action@v3
122132
with:
123133
username: ${{ secrets.DOCKER_USERNAME }}
124134
password: ${{ secrets.DOCKER_TOKEN }}
135+
125136
- name: Log in to GitHub Container Registry
126137
uses: docker/login-action@v3
127138
with:
128139
registry: ghcr.io
129140
username: ${{ github.repository_owner }}
130141
password: ${{ secrets.GITHUB_TOKEN }}
131-
- name: Set lower case owner name
132-
run: |
133-
echo "OWNER_LC=${OWNER,,}" >>${GITHUB_ENV}
134-
env:
135-
OWNER: ${{ github.repository_owner }}
136-
- name: Create and push manifest
137-
run: |
138-
docker manifest create fallenbagel/jellyseerr:develop \
139-
--amend fallenbagel/jellyseerr@${{ needs.build.outputs.digest-amd64 }} \
140-
--amend fallenbagel/jellyseerr@${{ needs.build.outputs.digest-arm64 }}
141-
docker manifest push fallenbagel/jellyseerr:develop
142142

143-
# GHCR manifest
144-
docker manifest create ghcr.io/${{ env.OWNER_LC }}/jellyseerr:develop \
145-
--amend ghcr.io/${{ env.OWNER_LC }}/jellyseerr@${{ needs.build.outputs.digest-amd64 }} \
146-
--amend ghcr.io/${{ env.OWNER_LC }}/jellyseerr@${{ needs.build.outputs.digest-arm64 }}
147-
docker manifest push ghcr.io/${{ env.OWNER_LC }}/jellyseerr:develop
143+
- name: Extract metadata
144+
id: meta
145+
uses: docker/metadata-action@v5
146+
with:
147+
images: |
148+
${{ github.repository }}
149+
ghcr.io/${{ github.repository }}
150+
tags: |
151+
type=raw,value=develop
152+
type=sha
153+
labels: |
154+
org.opencontainers.image.created=${{ steps.ts.outputs.TIMESTAMP }}
155+
156+
- name: Build & Push (multi-arch, single tag)
157+
uses: docker/build-push-action@v6
158+
with:
159+
context: .
160+
file: ./Dockerfile
161+
platforms: linux/amd64,linux/arm64
162+
push: true
163+
build-args: |
164+
COMMIT_TAG=${{ github.sha }}
165+
BUILD_VERSION=develop
166+
SOURCE_DATE_EPOCH=${{ steps.ts.outputs.TIMESTAMP }}
167+
labels: ${{ steps.meta.outputs.labels }}
168+
tags: ${{ steps.meta.outputs.tags }}
169+
cache-from: |
170+
type=gha,scope=linux/amd64
171+
type=gha,scope=linux/arm64
172+
cache-to: type=gha,mode=max
173+
provenance: false
148174

149175
discord:
150176
name: Send Discord Notification
151-
needs: merge_and_push
177+
needs: publish
152178
if: always() && github.event_name != 'pull_request' && !contains(github.event.head_commit.message, '[skip ci]')
153179
runs-on: ubuntu-24.04
154180
steps:
155-
- name: Get Build Job Status
156-
uses: technote-space/workflow-conclusion-action@v3
157181
- name: Combine Job Status
158182
id: status
159183
run: |
160184
failures=(neutral, skipped, timed_out, action_required)
161-
if [[ ${array[@]} =~ $WORKFLOW_CONCLUSION ]]; then
185+
if [[ ${array[@]} =~ ${{ needs.publish.result }} ]]; then
162186
echo "status=failure" >> $GITHUB_OUTPUT
163187
else
164-
echo "status=$WORKFLOW_CONCLUSION" >> $GITHUB_OUTPUT
188+
echo "status=${{ needs.publish.result }}" >> $GITHUB_OUTPUT
165189
fi
190+
166191
- name: Post Status to Discord
167192
uses: sarisia/actions-status-discord@v1
168193
with:

.github/workflows/codeql.yml

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,39 +3,52 @@ name: 'CodeQL'
33
on:
44
push:
55
branches: ['develop']
6+
paths-ignore:
7+
- '**/*.md'
8+
- 'docs/**'
69
pull_request:
710
branches: ['develop']
11+
paths-ignore:
12+
- '**/*.md'
13+
- 'docs/**'
814
schedule:
915
- cron: '50 7 * * 5'
1016

17+
permissions:
18+
contents: read
19+
20+
concurrency:
21+
group: codeql-${{ github.ref }}
22+
cancel-in-progress: true
23+
1124
jobs:
1225
analyze:
1326
name: Analyze
14-
runs-on: ubuntu-latest
27+
runs-on: ubuntu-24.04
28+
timeout-minutes: 10
1529
permissions:
16-
actions: read
1730
contents: read
1831
security-events: write
19-
2032
strategy:
2133
fail-fast: false
2234
matrix:
23-
language: [javascript]
24-
35+
language: [actions, javascript]
2536
steps:
2637
- name: Checkout
2738
uses: actions/checkout@v4
39+
with:
40+
persist-credentials: false
2841

2942
- name: Initialize CodeQL
30-
uses: github/codeql-action/init@v2
43+
uses: github/codeql-action/init@v3
3144
with:
3245
languages: ${{ matrix.language }}
3346
queries: +security-and-quality
3447

3548
- name: Autobuild
36-
uses: github/codeql-action/autobuild@v2
49+
uses: github/codeql-action/autobuild@v3
3750

3851
- name: Perform CodeQL Analysis
39-
uses: github/codeql-action/analyze@v2
52+
uses: github/codeql-action/analyze@v3
4053
with:
4154
category: '/language:${{ matrix.language }}'

.github/workflows/conflict_labeler.yml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,24 @@ name: Merge Conflict Labeler
22

33
on:
44
push:
5-
branches:
6-
- develop
5+
branches: [develop]
6+
77
pull_request_target:
8-
branches:
9-
- develop
10-
types: [synchronize]
8+
branches: [develop]
9+
types: [opened, synchronize, reopened]
10+
11+
permissions:
12+
contents: read
13+
14+
concurrency:
15+
group: merge-conflict-${{ github.ref }}
16+
cancel-in-progress: true
1117

1218
jobs:
1319
label:
1420
name: Labeling
15-
runs-on: ubuntu-latest
16-
if: ${{ github.repository == 'Fallenbagel/jellyseerr' }}
21+
runs-on: ubuntu-24.04
22+
timeout-minutes: 10
1723
permissions:
1824
contents: read
1925
pull-requests: write

0 commit comments

Comments
 (0)