-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (50 loc) · 2.14 KB
/
frontend.yml
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
name: Docker Publish Frontend
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
check:
runs-on: ubuntu-latest
outputs:
has_changes: ${{ steps.check_for_changes.outputs.has_changes }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 3
- name: Install turbo
run: npm install -g [email protected] && npm install -g turbo-ignore
- name: Check for changes
id: check_for_changes
run: npx turbo-ignore frontend --fallback=HEAD^1 && echo "has_changes=false" >> "$GITHUB_OUTPUT" || echo "has_changes=true" >> "$GITHUB_OUTPUT"
build:
runs-on: ubuntu-latest
needs: check
if: needs.check.outputs.has_changes == 'true'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 3
- name: Install turbo
run: npm install -g [email protected]
- name: Login to Docker
run: |
echo "${{ github.token }}" | docker login https://ghcr.io -u ${GITHUB_ACTOR} --password-stdin
- name: Create env file
run: |
touch apps/frontend/.env
echo KEYCLOAK_URL="https://auth.buildtheearth.net/realms/website" >> apps/frontend/.env
echo KEYCLOAK_ID="frontend" >> .env
echo KEYCLOAK_SECRET="${{ secrets.KEYCLOAK_SECRET }}" >> apps/frontend/.env
echo NEXTAUTH_URL="https://buildtheearth.net" >> apps/frontend/.env
echo NEXTAUTH_SECRET="${{ secrets.NEXTAUTH_SECRET }}" >> apps/frontend/.env
echo NEXT_PUBLIC_API_URL="https://api.buildtheearth.net/api/v1" >> apps/frontend/.env
echo NEXT_PUBLIC_MAPBOX_TOKEN="${{ secrets.MAPBOX_TOKEN }}" >> apps/frontend/.env
echo PORT=3000 >> apps/frontend/.env
- name: Build the Docker image
run: docker build . --file apps/frontend/Dockerfile --tag ghcr.io/buildtheearth/website-frontend:$(git rev-parse --short HEAD) --tag ghcr.io/buildtheearth/website-frontend:latest
- name: Docker push tag
run: docker push ghcr.io/buildtheearth/website-frontend:$(git rev-parse --short HEAD)
- name: Docker push latest
run: docker push ghcr.io/buildtheearth/website-frontend:latest