chore(deps): update npm #844
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 image | |
on: | |
push: | |
paths: | |
- "!.github/**" | |
- "src/**" | |
- "static/**" | |
- "**/*.json" | |
- "**/*.ya?ml" | |
- "**/*.ts" | |
- "**/*.c?jsx?" | |
- "Dockerfile" | |
workflow_dispatch: | |
inputs: | |
should_push: | |
type: boolean | |
description: Push image to registries | |
required: true | |
jobs: | |
build: | |
env: | |
SHOULD_PUSH: false | |
runs-on: ubuntu-latest | |
steps: | |
- name: Allow pushing to registry # Only when pushing to main, or when enabled upon dispatch | |
if: "(github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'workflow_dispatch' && github.event.inputs.should_push == true)" | |
run: echo "SHOULD_PUSH=true" >> $GITHUB_ENV | |
- name: Checkout | |
uses: actions/[email protected] | |
- name: Set up QEMU | |
uses: docker/[email protected] | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v3.8.0 | |
- name: Login to GHCR | |
uses: docker/[email protected] | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/[email protected] | |
with: | |
images: ghcr.io/${{ github.repository }} | |
- name: Build and push image | |
id: docker_build | |
uses: docker/[email protected] | |
with: | |
push: ${{ env.SHOULD_PUSH }} | |
platforms: linux/amd64 #,linux/arm64 | |
context: ${{ github.workspace }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Image digest | |
run: echo ${{ steps.docker_build.outputs.digest }} |