Skip to content

Workflow file for this run

name: Staging Docker Image
on:
push:
branches:
- main
- 31-docker
jobs:
build:
runs-on: self-hosted
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12.0-alpha.1' # Adjust this to match your project's Python version
- name: Extract version from pyproject.toml
id: extract_version
run: |
import toml
with open('pyproject.toml', 'r') as f:
config = toml.load(f)
version = config['project']['version']
print(f"Version: {version}")
print(f"::set-output name=version::{version}")
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: |
ghcr.io/econlabs/econlabs/jp-api:${{ steps.extract_version.outputs.version }}
ghcr.io/econlabs/econlabs/jp-api:latest