-
-
Notifications
You must be signed in to change notification settings - Fork 0
96 lines (71 loc) · 2.26 KB
/
ci.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
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
name: Test, build, and deploy to ghcr.io
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on: push
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
cache: yarn
- run: yarn install
- run: yarn lint
- run: yarn tsc
- run: yarn vitest run
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Nginx
run: sudo apt-get update && sudo apt-get install -y nginx
- name: Copy Nginx config to default location
run: sudo cp -r ./_nginx /etc/nginx
- name: Test Nginx configuration
run: sudo nginx -t
build:
if: github.ref == 'refs/heads/main'
needs:
- test
- validate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
cache: yarn
- run: yarn install
- name: Get build date
run: echo "VITE_BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")" >> $GITHUB_ENV
- run: yarn build
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/setup-buildx-action@v3
- uses: docker/build-push-action@v6
with:
push: ${{ github.event_name == 'push' }}
provenance: false
tags: ghcr.io/solectrus/configurator:latest
context: .
cache-from: type=gha
cache-to: type=gha,mode=max
labels: |
org.opencontainers.image.title=${{ github.event.repository.name }}
org.opencontainers.image.description=${{ github.event.repository.description }}
org.opencontainers.image.url=${{ github.event.repository.html_url }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.created=${{ env.VITE_BUILD_DATE }}
deploy:
if: github.ref == 'refs/heads/main'
needs: build
runs-on: ubuntu-latest
steps:
- env:
DEPLOY_HOOK: ${{ secrets.DEPLOY_HOOK }}
if: env.DEPLOY_HOOK != null
run: curl -X POST ${{ secrets.DEPLOY_HOOK }}