You've already forked hotpocket
BTHLABS-0000: development workflow
Co-authored-by: Tomek Wójcik <labs@tomekwojcik.pl> Co-committed-by: Tomek Wójcik <labs@tomekwojcik.pl>
This commit is contained in:
26
.gitea/actions/get-build-options/action.yaml
Normal file
26
.gitea/actions/get-build-options/action.yaml
Normal file
@@ -0,0 +1,26 @@
|
||||
name: "Get Build Options"
|
||||
description: "Sanitizies and unifies the environment into build options"
|
||||
outputs:
|
||||
short-sha:
|
||||
description: "Shortened hash if the current commit"
|
||||
build-arch:
|
||||
description: "Docker-compatible representation of build arch"
|
||||
build-platform:
|
||||
description: "Docker-compatible representation of build platform"
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: "Compute Build Options"
|
||||
shell: "bash"
|
||||
run: |
|
||||
set -x
|
||||
SHORT_SHA="${GITHUB_SHA::8}"
|
||||
BUILD_ARCH="amd64"
|
||||
BUILD_PLATFORM="linux/amd64"
|
||||
if [ "${RUNNER_ARCH}" = "ARM64" ];then
|
||||
BUILD_ARCH="arm64"
|
||||
BUILD_PLATFORM="linux/arm64"
|
||||
fi
|
||||
echo "short-sha=$SHORT_SHA" >> $GITHUB_OUTPUT
|
||||
echo "build-arch=$BUILD_ARCH" >> $GITHUB_OUTPUT
|
||||
echo "build-platform=$BUILD_PLATFORM" >> $GITHUB_OUTPUT
|
||||
17
.gitea/actions/get-run-info/action.yaml
Normal file
17
.gitea/actions/get-run-info/action.yaml
Normal file
@@ -0,0 +1,17 @@
|
||||
name: "Get Run Info"
|
||||
description: "Sanitizies and unifies the environment into run info"
|
||||
inputs:
|
||||
compose-project-base:
|
||||
description: "Base for the Compose project"
|
||||
required: true
|
||||
outputs:
|
||||
compose-project:
|
||||
description: "Compose project name"
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: "Compute Run Info"
|
||||
shell: "bash"
|
||||
run: |
|
||||
set -x
|
||||
echo "compose-project=${{ inputs.compose-project-base }}-${GITHUB_RUN_NUMBER}" >> $GITHUB_OUTPUT
|
||||
27
.gitea/actions/get-service-version/action.yaml
Normal file
27
.gitea/actions/get-service-version/action.yaml
Normal file
@@ -0,0 +1,27 @@
|
||||
name: "Get Run Info"
|
||||
description: "Sanitizies and unifies the environment into run info"
|
||||
inputs:
|
||||
service:
|
||||
description: "The service to work on"
|
||||
required: true
|
||||
outputs:
|
||||
version:
|
||||
description: "Service version"
|
||||
build-number:
|
||||
description: "Build number"
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: "Compute Service Version"
|
||||
shell: "bash"
|
||||
run: |
|
||||
set -x
|
||||
if [[ ! -z "${GITHUB_HEAD_REF}" || "${GITHUB_REF_NAME}" = "development" ]]; then
|
||||
VERSION="${GITHUB_SHA::8}"
|
||||
BUILD="${GITHUB_RUN_NUMBER}"
|
||||
else
|
||||
VERSION="v$(grep -Po '(?<=^version\s=\s")[^"]+' services/${{ inputs.service }}/pyproject.toml)"
|
||||
BUILD="01"
|
||||
fi
|
||||
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||
echo "build-number=$BUILD" >> $GITHUB_OUTPUT
|
||||
32
.gitea/actions/setup-k8s/action.yaml
Normal file
32
.gitea/actions/setup-k8s/action.yaml
Normal file
@@ -0,0 +1,32 @@
|
||||
name: "Set up k8s"
|
||||
description: "Downloads and installs k8s tools"
|
||||
inputs:
|
||||
arch:
|
||||
description: "Architecture"
|
||||
required: true
|
||||
kubectl-version:
|
||||
description: "kubectl version to install"
|
||||
required: false
|
||||
default: "1.33.4"
|
||||
kustomize-version:
|
||||
description: "kustomize version to install"
|
||||
required: false
|
||||
default: "5.7.1"
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: "Install k8s tools"
|
||||
shell: "bash"
|
||||
run: |
|
||||
set -x
|
||||
mkdir -p /opt/k8s/bin /opt/k8s/etc /opt/k8s/src
|
||||
|
||||
wget -O /opt/k8s/src/kubectl "https://nexus.bthlabs.pl/repository/ops-tools/k8s/kubectl-${{ inputs.kubectl-version }}-linux-${{ inputs.arch }}"
|
||||
chmod a+x /opt/k8s/src/kubectl
|
||||
mv /opt/k8s/src/kubectl /opt/k8s/bin
|
||||
|
||||
wget -O /opt/k8s/src/kustomize "https://nexus.bthlabs.pl/repository/ops-tools/k8s/kustomize-${{ inputs.kustomize-version }}-linux-${{ inputs.arch }}"
|
||||
chmod a+x /opt/k8s/src/kustomize
|
||||
mv /opt/k8s/src/kustomize /opt/k8s/bin
|
||||
|
||||
rm -rf /opt/k8s/src/
|
||||
Reference in New Issue
Block a user