change version agiang #41
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.11' # 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 | |