-
Notifications
You must be signed in to change notification settings - Fork 1
58 lines (52 loc) · 1.63 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
53
54
55
56
57
58
name: frontend
on:
workflow_dispatch:
push:
paths:
- "frontend/**"
- ".github/workflows/frontend.yml"
jobs:
frontend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
package_json_file: frontend/package.json
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- uses: actions/setup-node@v4
with:
node-version: '20'
- run: pnpm install
working-directory: frontend
- run: pnpm run lint
working-directory: frontend
- run: pnpm run build
working-directory: frontend
- name: Build docker image
id: docker_build
uses: docker/build-push-action@v6
with:
context: frontend
push: ${{ github.ref == 'refs/heads/main' }}
tags: blindern/intern-frontend:latest
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Deploy
if: github.ref == 'refs/heads/main'
run: |
curl --fail -L -i -H "authorization: bearer $DEPLOYER_TOKEN" -H "content-type: application/json" -X POST https://deployer.foreningenbs.no/deploy -d '
{
"service": "intern",
"attributes": {
"frontend_image": "blindern/intern-frontend@${{ steps.docker_build.outputs.digest }}"
}
}'
env:
DEPLOYER_TOKEN: ${{ secrets.DEPLOYER_TOKEN }}