Skip to content

Build main restreamer-ui #40

Build main restreamer-ui

Build main restreamer-ui #40

name: 'Build main restreamer-ui'
on:
workflow_dispatch:
jobs:
build-frontend:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.latestversion.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get latest version from package.json
id: latestversion
run: |
echo "version=$(cat ./package.json | jq '.version' | sed 's/\"//g')" >> "$GITHUB_OUTPUT"
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '21'
- name: Build React App
run: |
yarn install
yarn build
env:
PUBLIC_URL: './'
- name: Upload React build as artifact
uses: actions/upload-artifact@v4
with:
name: restreamerui-main-build
path: build/
build-docker:
needs: build-frontend
runs-on: [self-hosted]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download React build artifact
uses: actions/download-artifact@v4
with:
name: restreamerui-main-build
path: build
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
datarhei/restreamer-ui
tags: |
type=raw,value=latest
type=raw,value=${{ needs.build-frontend.outputs.version }}
- name: Set up QEMU
uses: docker/setup-qemu-action@master
with:
platforms: all
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@master
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and Push Docker Image
uses: docker/build-push-action@v5
with:
builder: ${{ steps.buildx.outputs.name }}
context: .
file: ./Dockerfile.workflow
build-args: |
CADDY_IMAGE=caddy:2.7.6-alpine
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}