66 lines
1.9 KiB
YAML
66 lines
1.9 KiB
YAML
name: Build Package
|
|
run-name: Build Python Package
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
version_suffix:
|
|
description: 'Suffix for version (z.B. "dev", "alpha", "beta")'
|
|
required: false
|
|
type: string
|
|
working_directory:
|
|
required: true
|
|
type: string
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: [ runner ]
|
|
container: git.sh-edraft.de/sh-edraft.de/act-runner:latest
|
|
defaults:
|
|
run:
|
|
working-directory: ${{ inputs.working_directory }}
|
|
|
|
steps:
|
|
- name: Clone Repository
|
|
uses: https://github.com/actions/checkout@v3
|
|
with:
|
|
token: ${{ secrets.CI_ACCESS_TOKEN }}
|
|
|
|
- name: Download build version artifact
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: version
|
|
|
|
- name: Set version
|
|
run: |
|
|
sed -i -E "s/^version = \".*\"/version = \"$(cat /workspace/sh-edraft.de/cpl/version.txt)\"/" pyproject.toml
|
|
echo "Set version to $(cat /workspace/sh-edraft.de/cpl/version.txt)"
|
|
cat pyproject.toml
|
|
|
|
- name: Set pip conf
|
|
run: |
|
|
cat > .pip.conf <<'EOF'
|
|
[global]
|
|
extra-index-url = https://git.sh-edraft.de/api/packages/sh-edraft.de/pypi/simple/
|
|
EOF
|
|
|
|
- name: Install Dependencies
|
|
run: |
|
|
export PIP_CONFIG_FILE=".pip.conf"
|
|
pip install build
|
|
|
|
- name: Build Package
|
|
run: |
|
|
python -m build --outdir dist
|
|
|
|
- name: Login to registry git.sh-edraft.de
|
|
uses: https://github.com/docker/login-action@v1
|
|
with:
|
|
registry: git.sh-edraft.de
|
|
username: ${{ secrets.CI_USERNAME }}
|
|
password: ${{ secrets.CI_ACCESS_TOKEN }}
|
|
|
|
- name: Push image
|
|
run: |
|
|
pip install twine
|
|
python -m twine upload --repository-url https://git.sh-edraft.de/api/packages/sh-edraft.de/pypi -u ${{ secrets.CI_USERNAME }} -p ${{ secrets.CI_ACCESS_TOKEN }} ./dist/* |