Skip to content

Updating workflow

Updating workflow #196

Workflow file for this run

name: CI
on:
pull_request:
push:
branches:
- main
- release*
- docker-build
tags:
- v*
env:
IMAGE_REGISTRY: quay.io/redhat-composer-ai/composer-ui
IMAGE_BASE_REGISTRY: quay.io
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: lts/*
- name: Install dependencies
run: npm install
- name: Run eslint
run: npm run lint
# TODO: Test currently failing
# test:
# name: Test
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v3
# - name: Setup Node.js
# uses: actions/setup-node@v3
# with:
# node-version: lts/*
# - name: Install dependencies
# run: npm install
# - name: Run tests
# run: npm run test
build:
# needs: test, lint //TODO: Add this back later, removing for speed
name: Build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://npm.pkg.github.com'
- name: Install dependencies
run: |
npm install
- name: Build Distribution
run: |
npm run build
# TODO: Figure out a cleaner way to do this
- name: 'Tar files'
run: tar -cvf dist.tar dist
- name: Archive node modules
uses: actions/upload-artifact@v4
with:
name: dist
path: dist.tar
include-hidden-files: true
retention-days: 1
build-and-push:
name: Build and Push Image to Quay
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to Docker Registry
uses: docker/login-action@v1
with:
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
registry: ${{ env.IMAGE_BASE_REGISTRY }}
- name: Download node modules
uses: actions/download-artifact@v4
with:
name: dist
path: .
- name: 'Untar files'
run: tar -xvf dist.tar
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: ./Containerfile
push: true
tags: ${{ env.IMAGE_REGISTRY }}:${{ github.ref_name }}, ${{ env.IMAGE_REGISTRY }}:latest
ulimit: nofile=4096