Skip to content

Commit

Permalink
odpi#47 implement github action based build for verification, merge i…
Browse files Browse the repository at this point in the history
…ncluding docker

Signed-off-by: Nigel Jones <nigel.l.jones+git@gmail.com>
  • Loading branch information
planetf1 committed Mar 15, 2021
1 parent b0b734d commit d0b015e
Showing 1 changed file with 78 additions and 0 deletions.
78 changes: 78 additions & 0 deletions .github/workflows/node-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# SPDX-License-Identifier: Apache-2.0
# # Copyright Contributors to the ODPi Egeria project.
#
name: Egeria UI build

on:
push:
branches: [master]
pull_request:
branches: [main]

jobs:

build:
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2.1.5
with:
# Polymer requires Node 10 LTS (not 12,14)
node-version: "10"
- name: Install Dependencies
run: npm install
- name: Lint
run: npm run lint
- name: Test
run: npm run test
- name: Build
run: npm run build
# 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
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
if: ${{ 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 master merge)
if: github.ref != 'refs/heads/master'
id: docker_build_release
uses: docker/build-push-action@v2
with:
push: ${{ github.event_name == 'push' && github.repository == 'odpi/egeria-ui' }}
tags: odpi/egeria-ui:${{ steps.package-version.outputs.current-version}}
context: .
file: ./Dockerfile
# For main code stream we push the image and add the latest tag
- name: Build and push (master merge)
if: github.ref == 'refs/heads/master'
id: docker_build_master
uses: docker/build-push-action@v2
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
context: .
file: ./Dockerfile
# Note the digest
- name: Image digest (release)
if: github.ref != 'refs/heads/main'
run: echo ${{ steps.docker_build_release.outputs.digest }}
- name: Image digest (main)
if: github.ref == 'refs/heads/main'
run: echo ${{ steps.docker_build_master.outputs.digest }}
# Save an artifact of the build tree & upload
- name: Create Archive
run: tar -zcf /tmp/egeria-ui.tar.gz .
- name: Upload
uses: actions/upload-artifact@v2
with:
name: Egeria UI {{ steps.package-version.outputs.current-version}}
path: /tmp/egeria-ui.tar.gz

0 comments on commit d0b015e

Please sign in to comment.