Skip to content

xeto: new XetoEnv class to standardize how to configure repo search path #1

xeto: new XetoEnv class to standardize how to configure repo search path

xeto: new XetoEnv class to standardize how to configure repo search path #1

name: Build and Publish Docker Image to GitHub Packages
# This workflow is run on any push to main, or on push tag when it starts with a 'v'
on:
push:
branches:
- main
tags:
- 'v*'
# This enables a workflow to be triggered manually
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository_owner }}/haxall
jobs:
build-and-publish-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# https://github.com/docker/metadata-action?tab=readme-ov-file#latest-tag
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3
with:
flavor: |
latest=auto
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
# tag with version number upon "git push tag"
type=match,pattern=v(.*),group=1
# set latest tag for default branch
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
# leave this on
type=ref,event=branch
# The github 'docker/bake-action' runs into a registry error...
# Using https://github.com/docker/build-push-action
- name: Build & push image with Github Action
uses: docker/build-push-action@v6
with:
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
#since the context is root, that's where the .dockerignore needs to be.
context: "{{defaultContext}}:."
file: ./docker/Dockerfile
push: true
pull: true
build-args:
DB_NAME=haxall