-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (39 loc) · 1.42 KB
/
docker-image.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
name: Docker Image CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
IMAGE_TAG: ${{ github.sha }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Docker Login
uses: docker/login-action@v3
if: github.event_name != 'pull_request'
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
- uses: actions/checkout@v4
- name: Setup Node.js environment
uses: actions/setup-node@v4
- name: Restore packages
run: npm ci --no-audit
working-directory: src/Bunkograph.Web/ClientApp
- name: Audit packages
run: npm audit --omit=dev
working-directory: src/Bunkograph.Web/ClientApp
- name: Run tests
run: npm test
working-directory: src/Bunkograph.Web/ClientApp
- name: Run linting
# ANSI codes for color break the pattern matching. Use the compact format to avoid them.
run: npx eslint . --ignore-pattern build\**
working-directory: src/Bunkograph.Web/ClientApp
- name: Build the Docker image
run: docker build . --file src/Bunkograph.Web/Dockerfile --tag hamsterexastris/bunkographweb:latest --tag hamsterexastris/bunkographweb:$IMAGE_TAG
- name: Upload the Docker image
if: github.event_name != 'pull_request'
run: docker push --all-tags hamsterexastris/bunkographweb