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

View File

@ -3,6 +3,12 @@ name: Python Package
on: on:
workflow_call: workflow_call:
inputs: inputs:
REGISTRY_DOMAIN:
required: true
type: string
REGISTRY_ORGANIZATION:
required: true
type: string
secrets: secrets:
PIPY_REPO_USER: PIPY_REPO_USER:
required: true required: true
@ -17,6 +23,16 @@ jobs:
container: container:
image: node:21-bookworm image: node:21-bookworm
steps: 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}} - name: Setting up Python ${{ env.PYTHON_VERSION }} for ${{runner.arch}} ${{runner.os}}
run: | run: |
apt-get update apt-get update
@ -32,5 +48,4 @@ jobs:
run: python3 -m build run: python3 -m build
- name: Publish - name: Publish
if: success() 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/*