forked from SuperFlyTV/sofie-demo-blueprints
-
Notifications
You must be signed in to change notification settings - Fork 4
125 lines (110 loc) · 3.32 KB
/
node.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
name: Node CI
env:
node-version: 16.14
node-packager-manager: yarn
on:
push:
branches:
- '**'
tags:
- '**'
workflow_dispatch:
jobs:
run-yarn-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- uses: actions/setup-node@v2
with:
node-version: "16.14"
registry-url: "https://registry.npmjs.org"
- name: yarn install
run: yarn install --check-files --frozen-lockfile
- name: yarn validate:dependencies
run: yarn validate:dependencies
- name: yarn build
run: yarn build
# - name: yarn unit test
# run: yarn unit
# - name: yarn install production
# run: yarn install --check-files --frozen-lockfile --production --force
- uses: actions/upload-artifact@main
with:
name: dist artifacts
path: dist
dockerhub-release-master:
runs-on: ubuntu-latest
needs: [run-yarn-build]
if: |
((github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop') ||
startsWith(github.ref, 'refs/tags/v')) &&
github.event_name != 'pull_request'
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
name: dist artifacts
path: dist
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: "tv2media/${{ github.event.repository.name }}"
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Log in to GitHub Docker Registry
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push docker image tags
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
dockerhub-release-custom-tag:
runs-on: ubuntu-latest
needs: [run-yarn-build]
if: |
startsWith(github.ref, 'refs/tags/') && !startsWith(github.ref, 'refs/tags/v')
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
name: dist artifacts
path: dist
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: "tv2media/${{ github.event.repository.name }}"
tags: |
type=ref,event=tag
- name: Log in to GitHub Docker Registry
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push docker image tags
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}