name: ci on: workflow_dispatch: push: # pull_request: # branches: main jobs: build: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v2 - uses: actions/setup-node@v2 with: cache: "npm" cache-dependency-path: "**/package-lock.json" node-version-file: ".nvmrc" - name: Install packages for server run: npm ci --ignore-scripts - name: Install Packages for client run: npm ci --ignore-scripts working-directory: ./client - name: Run tests run: npm run test - name: Eliminate devDependencies run: npm prune --production - name: Build web client run: DOCKER_BUILD=true npm run build working-directory: ./client - name: Docker meta id: docker_meta uses: crazy-max/ghaction-docker-meta@v1 with: images: ghcr.io/${{ github.repository_owner }}/github-action-dashboard tag-sha: true tag-edge: true tag-latest: true github-token: ${{ secrets.GITHUB_TOKEN }} - name: Set up QEMU uses: docker/setup-qemu-action@v1 - name: Set up Docker Buildx id: buildx uses: docker/setup-buildx-action@v1 #with: # hack for https://github.com/docker/build-push-action/issues/126 #driver-opts: image=moby/buildkit:master - name: Available platforms run: echo ${{ steps.buildx.outputs.platforms }} - name: Login to GitHub Container Registry if: github.event_name != 'pull_request' uses: docker/login-action@v1 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GH_CR_PAT }} - name: Build and push id: docker_build uses: docker/build-push-action@v2 with: context: . file: ./Dockerfile push: ${{ github.event_name != 'pull_request' }} platforms: linux/amd64,linux/arm64 tags: ${{ steps.docker_meta.outputs.tags }} cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/github-action-dashboard:edge cache-to: type=inline - name: Image digest run: echo ${{ steps.docker_build.outputs.digest }} #this is for logging.