This repository has been archived by the owner on Apr 30, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 48
60 lines (58 loc) · 2.08 KB
/
mergeToSelectedBranches.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
name: Build and push on merge to selected branches
on:
push:
branches:
- master
- wizard
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Set environment variables
run: |
echo "NODE_OPTIONS=--max-old-space-size=8192" >> $GITHUB_ENV
echo "BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
echo "GIT_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
echo "REACT_APP_GIT_SHA=${{ github.sha }}" >> $GITHUB_ENV
echo "REACT_APP_VERSION=${{ env.GIT_TAG }}" >> $GITHUB_ENV
- name: Set IMAGE_TAGS env variable
if: github.ref == 'refs/heads/master'
run: |
echo "IMAGE_TAGS=latest,${{ github.sha }},${GITHUB_REF#refs/heads/}-${{ github.sha }}" >> $GITHUB_ENV
- name: Set IMAGE_TAGS env variable
if: github.ref != 'refs/heads/master'
run: |
echo "IMAGE_TAGS=${{ github.sha }},${GITHUB_REF#refs/heads/}-${{ github.sha }}" >> $GITHUB_ENV
- name: Read environment variables
run: |
echo BRANCH: ${BRANCH}
echo GIT_TAG: ${GIT_TAG}
echo IMAGE_TAGS: ${IMAGE_TAGS}
echo NODE_OPTIONS: ${NODE_OPTIONS}
echo REACT_APP_GIT_SHA: ${REACT_APP_GIT_SHA}
echo REACT_APP_VERSION: ${REACT_APP_VERSION}
- name: Check out code
uses: actions/checkout@v2
- name: Setup Node.JS
uses: actions/setup-node@v2
with:
node-version: '14.x'
registry-url: 'https://registry.npmjs.org'
- name: Node version
run: |
echo Node version: `node --version`
- name: Install dependencies
run: yarn install
- name: Call linter
run: yarn lint
- name: Build code
run: yarn build
- name: Publish to quay.io
uses: elgohr/Publish-Docker-Github-Action@2.14
with:
name: ocpmetal/ocp-metal-ui
username: ${{ secrets.QUAYIO_OCPMETAL_USERNAME }}
password: ${{ secrets.QUAYIO_OCPMETAL_PASSWORD }}
registry: quay.io
dockerfile: Dockerfile
tags: '${{ env.IMAGE_TAGS }}'