Skip to content

Trying ghcr

Trying ghcr #1

Workflow file for this run

name: Build and Push Docker image to GHCR
on:
push:
tags:
- 'v*'
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.10'
- name: Install hatch
run: pip install hatch
- name: Extract version using Hatch
id: get_version
run: echo "VERSION=$(hatch version)" >> $GITHUB_ENV
- name: Log in to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GTOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: true
tags: ghcr.io/${{ github.repository }}/app:${{ env.VERSION }}
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}