fasten-onprem/.github/workflows/build.yaml

67 lines
2.1 KiB
YAML
Raw Normal View History

2022-09-27 08:47:50 -06:00
name: Docker
on:
push:
branches: [ main, sandbox ]
# Publish semver tags as releases.
tags: [ 'v*.*.*' ]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
2023-01-26 02:41:10 -07:00
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
2022-09-27 08:47:50 -06:00
jobs:
2022-09-27 08:53:00 -06:00
docker:
2022-09-27 08:47:50 -06:00
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
2022-09-27 08:47:50 -06:00
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: "Populate frontend version information"
run: "cd frontend && ./git.version.sh"
- name: Set up depot.dev multi-arch runner
uses: depot/setup-action@v1
2022-09-27 08:47:50 -06:00
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
2023-01-25 19:00:13 -07:00
flavor: |
latest=${{ github.event_name == 'push' && contains(github.ref, 'refs/tags/') }}
2022-09-27 08:47:50 -06:00
tags: |
type=ref,enable=true,event=branch
type=ref,enable=true,event=tag
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
uses: depot/build-push-action@v1
2022-09-27 08:47:50 -06:00
with:
project: vhwr5r7tw1
platforms: linux/amd64,linux/arm64,linux/arm/v7
2022-09-27 08:47:50 -06:00
context: .
2022-09-27 08:53:00 -06:00
file: Dockerfile
2022-09-27 08:47:50 -06:00
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
2022-12-17 16:10:19 -07:00
build-args: |
2022-12-18 08:58:55 -07:00
FASTEN_ENV=${{ github.ref_name == 'sandbox' && 'sandbox' || 'prod' }}