38 lines
1.1 KiB
YAML
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
|