fix: improve ui #558
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Images | |
on: | |
push: | |
branches: [main] | |
tags: [v*] | |
pull_request: | |
branches: [main] | |
env: | |
PLATFORMS: linux/amd64,linux/arm64 | |
ARCHS: amd64,arm64 | |
IMAGE_PREFIX: ghcr.io/webmeshproj/vdi | |
VERSION: ${{ startswith(github.ref, 'refs/tags/v') && github.ref || 'latest' }} | |
GO_VERSION: 1.21 | |
NODE_VERSION: 16 | |
BUILD_IDS: --id app --id manager --id proxy | |
CACHE_DEP_PATH: go.sum | |
BUILD_PARALLELISM: 4 | |
COSIGN_EXPERIMENTAL: 1 | |
jobs: | |
build: | |
name: Build Images | |
runs-on: self-hosted | |
permissions: | |
contents: "write" | |
id-token: "write" | |
packages: "write" | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
check-latest: true | |
cache: false | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
# - name: Setup Build Cache | |
# uses: actions/cache@v3 | |
# with: | |
# key: ${{ runner.os }}-build-${{ hashFiles(env.CACHE_DEP_PATH) }} | |
# restore-keys: ${{ runner.os }}-build-${{ env.GO_VERSION }}- | |
# path: | | |
# ~/go/pkg | |
# ~/.cache/go-build | |
# ui/app/node_modules | |
- name: Login to GHCR | |
uses: docker/login-action@v3 | |
if: ${{ github.event_name != 'pull_request' }} | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ github.token }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: ${{ env.ARCHS }} | |
- name: Setup Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Setup Cosign | |
uses: sigstore/cosign-installer@main | |
- name: Run Snapshot Container Release | |
uses: goreleaser/goreleaser-action@v5 | |
if: ${{ !startsWith(github.ref, 'refs/tags/v') }} | |
with: | |
version: latest | |
args: build --snapshot --clean ${{ env.BUILD_IDS }} | |
- name: Run Container Release | |
uses: goreleaser/goreleaser-action@v5 | |
if: ${{ startsWith(github.ref, 'refs/tags/v') }} | |
with: | |
version: latest | |
args: build --clean --fail-fast --parallelism=${{ env.BUILD_PARALLELISM }} ${{ env.BUILD_IDS }} | |
- name: Build UI Assets | |
shell: bash | |
run: | | |
yarn global add @quasar/cli | |
cd ui/app && yarn install && $(yarn global bin)/quasar build | |
- name: Build and Push Manager Image | |
uses: docker/build-push-action@v5 | |
id: manager-build | |
with: | |
context: . | |
file: build/Dockerfile.manager | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ env.IMAGE_PREFIX }}-manager:${{ env.VERSION }} | |
platforms: ${{ env.PLATFORMS }} | |
- name: Build and Push App Image | |
uses: docker/build-push-action@v5 | |
id: app-build | |
with: | |
context: . | |
file: build/Dockerfile.app | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ env.IMAGE_PREFIX }}-app:${{ env.VERSION }} | |
platforms: ${{ env.PLATFORMS }} | |
- name: Build and Push Proxy Image | |
uses: docker/build-push-action@v5 | |
id: proxy-build | |
with: | |
context: . | |
file: build/Dockerfile.proxy | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ env.IMAGE_PREFIX }}-proxy:${{ env.VERSION }} | |
platforms: ${{ env.PLATFORMS }} | |
- name: Sign Container Images | |
if: ${{ github.event_name != 'pull_request' }} | |
run: | | |
cosign sign --yes --recursive ${{ env.IMAGE_PREFIX }}-manager@${{ steps.manager-build.outputs.digest }} | |
cosign sign --yes --recursive ${{ env.IMAGE_PREFIX }}-app@${{ steps.app-build.outputs.digest }} | |
cosign sign --yes --recursive ${{ env.IMAGE_PREFIX }}-proxy@${{ steps.proxy-build.outputs.digest }} |