-
-
Notifications
You must be signed in to change notification settings - Fork 47
87 lines (70 loc) · 2.22 KB
/
push.yaml
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
name: Test and build
on: [push, pull_request]
jobs:
build:
name: Build and lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Node 16
uses: actions/setup-node@v1
with:
node-version: 16.x
- name: Install yarn
run: npm install -g yarn
- name: Get yarn cache directory path
id: yarn-cache-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- name: Get yarn cache
uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn install --immutable
- name: Lint
run: yarn lint
- name: Build
run: yarn build
docker:
name: Build Docker container and push to registry
# Only run on pushes to dev & master
if:
${{ contains(fromJson('["master", "dev"]'), github.ref_name) &&
github.event_name == 'push' }}
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to ghcr.io registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set tag name
id: tag
run:
'echo "::set-output name=tag::${{ github.ref_name == ''master'' &&
''latest'' || github.ref_name }}"'
- name: Build & push container
uses: docker/build-push-action@v2
with:
push: true
tags: |
ghcr.io/ovyerus/prismaliser:${{ steps.tag.outputs.tag }}
ovyerus/prismaliser:${{ steps.tag.outputs.tag }}