change to use local python #47
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@v4 | |
with: | |
python-version: /usr/bin/python3 # Adjust as needed | |
- name: Install toml package | |
run: | | |
python -m pip install toml | |
- 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"::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:testing | |
ghcr.io/econlabs/econlabs/jp-api:${{ steps.extract_version.outputs.version }} | |
build-args: | | |
VERSION=${{ steps.extract_version.outputs.version }} |