-
-
Notifications
You must be signed in to change notification settings - Fork 27
84 lines (70 loc) · 2.09 KB
/
docker-build-and-push.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
name: Build and Push Docker Images
on:
push:
branches:
- main
tags:
- 'v*.*.*'
pull_request:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.22
- name: Install dependencies
run: go mod download
- name: Run Go tests
run: go test ./...
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 20
- name: Cache npm dependencies
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install frontend dependencies
run: npm install
working-directory: web-app
- name: Run frontend tests
run: npm test
working-directory: web-app
build-and-push:
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Build and push Docker images
id: docker_build
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
cache-from: type=gha
cache-to: type=gha,mode=max
tags: |
icereed/paperless-gpt:unreleased
${{ github.ref == 'refs/heads/main' && 'icereed/paperless-gpt:unreleased' }}
${{ github.ref_type == 'tag' && 'icereed/paperless-gpt:latest' }}
${{ github.ref_type == 'tag' && 'icereed/paperless-gpt:${{ github.ref_name }}' }}