6
0

Standardized inputs

This commit is contained in:
Jon Michael Aanes 2024-05-04 23:53:49 +02:00
parent c489457f36
commit 8f3c8e1de6
Signed by: Jmaa
SSH Key Fingerprint: SHA256:Ab0GfHGCblESJx7JRE4fj4bFy/KRpeLhi41y4pF3sNA
2 changed files with 27 additions and 11 deletions

View File

@ -3,16 +3,17 @@ name: Container creation using Dockerfile
on:
workflow_call:
inputs:
DOCKER_REG_DOMAIN:
REGISTRY_DOMAIN:
description: Domain of the Gitea instance used as registry.
required: true
type: string
default: gitfub.space
DOCKER_ORG:
REGISTRY_ORGANIZATION:
description: Gitea organization or user to use as registry.
required: true
type: string
DOCKER_LATEST:
description: Tag for latest version
required: false
type: string
default: latest
@ -42,12 +43,12 @@ jobs:
steps:
- name: Check inputs
run: |
if [[ -z "${{ inputs.DOCKER_REG_DOMAIN }}" ]]; then
echo "Must provide: jobs.<id>.with.DOCKER_REG_DOMAIN"
if [[ -z "${{ inputs.REGISTRY_DOMAIN }}" ]]; then
echo "Must provide: jobs.<id>.with.REGISTRY_DOMAIN"
exit 1
fi
if [[ -z "${{ inputs.DOCKER_ORG }}" ]]; then
echo "Must provide: jobs.<id>.with.DOCKER_ORG"
if [[ -z "${{ inputs.REGISTRY_ORGANIZATION }}" ]]; then
echo "Must provide: jobs.<id>.with.REGISTRY_ORGANIZATION"
exit 1
fi
if [[ -z "${{ inputs.DOCKER_LATEST }}" ]]; then
@ -113,7 +114,7 @@ jobs:
- name: Login to Docker Registry
uses: docker/login-action@v2
with:
registry: ${{ inputs.DOCKER_REG_DOMAIN }}
registry: ${{ inputs.REGISTRY_DOMAIN }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
@ -132,5 +133,5 @@ jobs:
linux/amd64
push: true
tags: |
${{ inputs.DOCKER_REG_DOMAIN }}/${{ inputs.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.meta.outputs.REPO_VERSION }}
${{ inputs.DOCKER_REG_DOMAIN }}/${{ inputs.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:${{ inputs.DOCKER_LATEST }}
${{ inputs.REGISTRY_DOMAIN }}/${{ inputs.REGISTRY_ORGANIZATION }}/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.meta.outputs.REPO_VERSION }}
${{ inputs.REGISTRY_DOMAIN }}/${{ inputs.REGISTRY_ORGANIZATION }}/${{ steps.meta.outputs.REPO_NAME }}:${{ inputs.DOCKER_LATEST }}

View File

@ -3,6 +3,12 @@ name: Python Package
on:
workflow_call:
inputs:
REGISTRY_DOMAIN:
required: true
type: string
REGISTRY_ORGANIZATION:
required: true
type: string
secrets:
PIPY_REPO_USER:
required: true
@ -17,6 +23,16 @@ jobs:
container:
image: node:21-bookworm
steps:
- name: Check inputs
run: |
if [[ -z "${{ inputs.REGISTRY_DOMAIN }}" ]]; then
echo "Must provide: jobs.<id>.with.REGISTRY_DOMAIN"
exit 1
fi
if [[ -z "${{ inputs.REGISTRY_ORGANIZATION }}" ]]; then
echo "Must provide: jobs.<id>.with.REGISTRY_ORGANIZATION"
exit 1
fi
- name: Setting up Python ${{ env.PYTHON_VERSION }} for ${{runner.arch}} ${{runner.os}}
run: |
apt-get update
@ -32,5 +48,4 @@ jobs:
run: python3 -m build
- name: Publish
if: success()
run: python3 -m twine upload --repository-url "https://gitfub.space/api/packages/${{ secrets.PIPY_REPO_USER }}/pypi" -u ${{ secrets.PIPY_REPO_USER }} -p ${{ secrets.PIPY_REPO_PASS }} dist/*
run: python3 -m twine upload --repository-url "https://${{ inputs.REGISTRY_DOMAIN }}/api/packages/${{ inputs.REGISTRY_ORGANIZATION }}/pypi" -u ${{ secrets.PIPY_REPO_USER }} -p ${{ secrets.PIPY_REPO_PASS }} dist/*