This repository has been archived by the owner on Jun 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
98 lines (95 loc) · 3.98 KB
/
node-build.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
# SPDX-License-Identifier: Apache-2.0
# # Copyright Contributors to the ODPi Egeria project.
#
name: Egeria UI Build
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v3.1.0
- name: Check if version has been updated
id: check
uses: EndBug/version-check@v1
- name: Setup Node.js
uses: actions/setup-node@v3.5.1
with:
node-version: "16.13.0"
- name: Report npm and node version
run: |
node -v
npm -v
- name: Install Dependencies
run: npm install
- name: Lint
run: npm run lint
- name: Test
run: npm run test
- name: Build
run: npm run build
env:
NODE_OPTIONS: "--max_old_space_size=6144"
# Get package version from the package.json
- name: get-npm-version
id: package-version
uses: martinbeentjes/npm-get-version-action@master
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
if: ${{ steps.check.outputs.changed == 'true' }}
- name: Login to DockerHub
uses: docker/login-action@v1
if: ${{ steps.check.outputs.changed == 'true' && github.event_name == 'push' && github.repository == 'odpi/egeria-ui' }}
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Login to container registry (Quay.io)
uses: docker/login-action@v1
with:
registry: quay.io
username: ${{ secrets.QUAY_IO_USERNAME }}
password: ${{ secrets.QUAY_IO_ACCESS_TOKEN }}
if: ${{ steps.check.outputs.changed == 'true' && github.event_name == 'push' && github.repository == 'odpi/egeria-ui' }}
# For releases (ie not main) we push the image - but not the latest tag
- name: Build and push (not main merge)
id: docker_build_release
uses: docker/build-push-action@v2
if: ${{ steps.check.outputs.changed == 'true' && github.ref != 'refs/heads/main' }}
with:
push: ${{ github.event_name == 'push' && github.repository == 'odpi/egeria-ui' }}
tags: odpi/egeria-ui:${{ steps.package-version.outputs.current-version}}, quay.io/odpi/egeria-ui:${{ steps.package-version.outputs.current-version}}
context: .
file: ./Dockerfile
platforms: linux/amd64, linux/arm64
# For main code stream we push the image and add the latest tag
- name: Build and push (main merge)
id: docker_build_main
uses: docker/build-push-action@v2
if: ${{ steps.check.outputs.changed == 'true' && github.ref == 'refs/heads/main' }}
with:
push: ${{ github.event_name == 'push' && github.repository == 'odpi/egeria-ui' }}
tags: odpi/egeria-ui:${{ steps.package-version.outputs.current-version }}, odpi/egeria-ui:latest, quay.io/odpi/egeria-ui:${{ steps.package-version.outputs.current-version }}, quay.io/odpi/egeria-ui:latest
context: .
file: ./Dockerfile
platforms: linux/amd64, linux/arm64
# Note the digest
- name: Image digest (release)
if: ${{ steps.check.outputs.changed == 'true' && github.ref != 'refs/heads/main' }}
run: echo ${{ steps.docker_build_release.outputs.digest }}
- name: Image digest (main)
if: ${{ steps.check.outputs.changed == 'true' && github.ref == 'refs/heads/main' }}
run: echo ${{ steps.docker_build_main.outputs.digest }}
# Save an artifact of the build tree & upload
- name: Create Archive
if: ${{ steps.check.outputs.changed == 'true' }}
run: tar -zcf /tmp/egeria-ui.tar.gz .
- name: Upload
uses: actions/upload-artifact@v2
if: ${{ steps.check.outputs.changed == 'true' }}
with:
name: Egeria UI ${{ steps.package-version.outputs.current-version }}
path: /tmp/egeria-ui.tar.gz