ignore multi-arch builds for now #43
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, Test, Deploy | |
on: | |
push: | |
branches: | |
- "master" | |
- "main" | |
tags: | |
- "v*" | |
pull_request: | |
workflow_dispatch: | |
permissions: | |
contents: read | |
packages: write ## Github container registry | |
# deployments: write ## Github Pages | |
concurrency: ci-${{ github.ref }} | |
jobs: | |
build-and-test: | |
strategy: | |
fail-fast: true | |
matrix: | |
os: [ubuntu-latest] #, windows-latest ] # windows takes ~3x longer, not worth the cost for larger projects | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 5 | |
steps: | |
- name: Checkout 🛎️ | |
uses: actions/checkout@v4 | |
with: | |
lfs: true | |
- name: Set up Node ⚙ | |
uses: actions/setup-node@v4 | |
- name: Install dependencies & build ⚙️ | |
run: | | |
npm ci | |
npm run build | |
- name: Lint 🔍 | |
run: | | |
npm run lint | |
- name: Test 🔍 | |
run: | | |
npm run test:unit | |
build-and-push-docker: | |
needs: build-and-test | |
if: github.ref == 'refs/heads/{{ github.event.repository.default_branch }}' || startsWith(github.ref, 'refs/tags/v') | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- name: Checkout 🛎️ | |
# uses: actions/checkout@v3 # incompatible with git lfs cache (https://github.com/actions/checkout/issues/165#issuecomment-940225299) | |
uses: nschloe/[email protected] | |
with: | |
exclude: "docs/*" | |
# https://github.com/docker/metadata-action | |
- name: Export Metadata for Docker 🖊️ | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
modischfabrications/cutsolver_frontend | |
ghcr.io/${{ github.repository_owner }}/cutsolver_frontend | |
tags: | | |
type=ref,event=branch | |
type=semver,pattern={{version}} | |
# Multi-Arch takes over 30min right now, it's not worth it | |
# # https://github.com/docker/setup-qemu-action | |
# - name: Set up QEMU ⚙ | |
# uses: docker/setup-qemu-action@v3 | |
# # https://github.com/docker/setup-buildx-action | |
# - name: Set up Docker Buildx ⚙ | |
# id: buildx | |
# uses: docker/setup-buildx-action@v3 | |
# - name: Report Buildx platforms 🖊️ | |
# run: echo ${{ steps.buildx.outputs.platforms }} | |
- name: Login to DH 👤 | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Login to GHCR 👤 | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# https://github.com/docker/build-push-action | |
- name: Build and push to DH & GHCR 📦 | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
# platforms: linux/amd64,linux/arm64,linux/arm/v7 | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=registry,ref=user/app:latest | |
cache-to: type=inline | |
- name: Update DH description 🖊️ | |
uses: peter-evans/dockerhub-description@v4 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
repository: modischfabrications/cutsolver_frontend | |
readme-filepath: ./README.md | |
short-description: ${{ github.event.repository.description }} |