name: 'Build restreamer-ui' on: workflow_dispatch: jobs: build-frontend: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v2 - name: Set up Node.js uses: actions/setup-node@v2 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@v2 with: name: react-build path: build/ build-docker: needs: build-frontend runs-on: [self-hosted] steps: - name: Checkout uses: actions/checkout@v2 - name: Load ENV from file run: | cat .github_build/Build.restreamer-ui.env >> $GITHUB_ENV - name: Download React build artifact uses: actions/download-artifact@v2 with: name: react-build path: build - uses: actions-ecosystem/action-get-latest-tag@v1 id: get-latest-tag with: semver_only: true - name: Docker meta id: meta uses: docker/metadata-action@v4 env: RELEASE: ${{ env.RELEASE }} CADDY_IMAGE: ${{ env.CADDY_IMAGE }} with: images: | datarhei/restreamer-ui tags: | type=raw,value=latest type=raw,value=${{ env.RELEASE }} - 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: Cache Docker layers uses: actions/cache@v2 with: path: /tmp/.buildx-cache key: ${{ runner.os }}-buildx-${{ github.sha }} restore-keys: | ${{ runner.os }}-buildx- - name: Login to DockerHub if: github.event_name != 'pull_request' uses: docker/login-action@v1 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - name: Build and Push Docker Image uses: docker/build-push-action@v2 with: builder: ${{ steps.buildx.outputs.name }} context: . file: ./Dockerfile.workflow build-args: | PUBLIC_URL=${{ env.PUBLIC_URL }} CADDY_IMAGE=${{ env.CADDY_IMAGE }} platforms: linux/amd64,linux/arm64,linux/arm/v7 push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache-new