Skip to content

Commit 1c97deb

Browse files
committed
gha: build a version for deployment to beta.frikanalen.no
1 parent 89ff50c commit 1c97deb

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Build and push frontend for beta.frikanalen.no
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
permissions:
10+
contents: read
11+
packages: write # Needed to push to ghcr.io
12+
13+
jobs:
14+
build:
15+
name: Build and push prod Docker image to GHCR
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
22+
- name: Set up Docker Buildx
23+
uses: docker/setup-buildx-action@v3
24+
25+
- name: Extract Docker metadata (tags, labels)
26+
id: meta
27+
uses: docker/metadata-action@v5
28+
with:
29+
images: ghcr.io/frikanalen/legacy-frontend-beta
30+
tags: |
31+
type=raw,value=latest,enable={{is_default_branch}}
32+
type=ref,event=tag
33+
type=ref,event=branch
34+
type=ref,event=tag
35+
type=raw,value=latest
36+
type=sha
37+
38+
- name: Log in to GHCR
39+
uses: docker/login-action@v3
40+
with:
41+
registry: ghcr.io
42+
username: ${{ github.actor }}
43+
password: ${{ secrets.GITHUB_TOKEN }}
44+
45+
- name: Build and (if not PR) push
46+
uses: docker/build-push-action@v5
47+
with:
48+
build-args: |
49+
NEXT_PUBLIC_DJANGO_URL="https://beta.frikanalen.no/api/"
50+
NEXT_PUBLIC_UPLOAD_URL="https://beta.frikanalen.no/upload/files"
51+
push: ${{ github.event_name != 'pull_request' }}
52+
tags: ${{ steps.meta.outputs.tags }}
53+
labels: ${{ steps.meta.outputs.labels }}
54+
cache-from: type=gha
55+
cache-to: type=gha,mode=max
56+

0 commit comments

Comments
 (0)