Feature: Add part name #36
Workflow file for this run
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@v3 | |
- name: Set up Node ⚙ | |
uses: actions/setup-node@v3 | |
- 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 == format('refs/heads/{0}', github.event.repository.default_branch) || | |
startsWith(github.ref, 'refs/tags/v') && github.event.base_ref == format('refs/heads/{0}', github.event.repository.default_branch) | |
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@v4 | |
with: | |
images: | | |
modischfabrications/cutsolver_frontend | |
ghcr.io/${{ github.repository_owner }}/cutsolver_frontend | |
tags: | | |
type=ref,event=branch | |
type=semver,pattern={{version}} | |
# https://github.com/docker/setup-qemu-action | |
- name: Set up QEMU ⚙ | |
uses: docker/setup-qemu-action@v2 | |
# https://github.com/docker/setup-buildx-action | |
- name: Set up Docker Buildx ⚙ | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Report Buildx platforms 🖊️ | |
run: echo ${{ steps.buildx.outputs.platforms }} | |
- name: Login to DH 👤 | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Login to GHCR 👤 | |
uses: docker/login-action@v2 | |
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@v3 | |
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@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
repository: modischfabrications/cutsolver_frontend | |
readme-filepath: ./README.md | |
short-description: ${{ github.event.repository.description }} |