38789-vm/.github/workflows/ghcr-publish.yml
Workflow config file is invalid. Please check your config file: yaml: line 3: mapping values are not allowed in this context
gamvo74 85fc8b4024
Add API publishing to GitHub Container Registry workflow
Updated workflow to publish API Docker image to GitHub Container Registry.
2026-02-22 08:42:55 -05:00

38 lines
1.1 KiB
YAML

name: Publish API to GitHub Container Registry
on:
push:
branches:
- main
jobs:
build-and-push-api:
runs-on: ubuntu-latest
# This permission is necessary to allow the workflow to write to GitHub Packages.
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
# This tells Docker where to find your Dockerfile and code
context: ./apps/api
push: true
# This will tag the image with both 'latest' and 'main'
tags: ghcr.io/${{ github.repository }}:latest,ghcr.io/${{ github.repository }}:main