Added many, many more actions.

This commit is contained in:
2025-06-24 15:24:16 -07:00
parent 62fbe4dead
commit 57ef232d2b
108 changed files with 4212 additions and 7 deletions

View File

@@ -0,0 +1,59 @@
name: version-increment
description: "Increment a semantic version 2.0."
inputs:
incrementMode:
description: "The mode to increment by. Options: 'default', 'major', 'minor', 'patch', 'revision'"
required: true
default: default
gitShaMetadata:
description: "Whether or not to update the git sha in the metadata."
required: false
default: "false"
major:
description: "The latest major version of the package."
required: false
minor:
description: "The latest minor version of the package."
required: false
patch:
description: "The latest patch version of the package."
required: false
revision:
description: "The latest patch revision version of the package. The suffix treated as a number seperated by a '.'"
required: false
suffix:
description: "The suffix of the package."
required: false
metadata:
description: "The metadata of the package."
required: false
outputs:
nextVersion:
description: "The next version of the package."
value: ${{ steps.parse.outputs.nextVersion }}
nextMajor:
description: "The next major version of the package."
value: ${{ steps.parse.outputs.nextMajor }}
nextMinor:
description: "The next minor version of the package."
value: ${{ steps.parse.outputs.nextMinor }}
nextPatch:
description: "The next patch version of the package."
value: ${{ steps.parse.outputs.nextPatch }}
nextRevision:
description: "The next patch revision version of the package."
value: ${{ steps.parse.outputs.nextRevision }}
nextSuffix:
description: "The next version of suffix of the package."
value: ${{ steps.parse.outputs.nextSuffix }}
nextMetadata:
description: "The next version of metadata of the package."
value: ${{ steps.parse.outputs.nextMetadata }}
runs:
using: "composite"
steps:
- name: "Get next version."
id: parse
run: |
bash ${{ github.action_path }}/increment_version.sh "${{ inputs.major }}" "${{ inputs.minor }}" "${{ inputs.patch }}" "${{ inputs.revision }}" "${{ inputs.suffix }}" "${{ inputs.metadata }}" "${{ inputs.incrementMode }}" "${{ inputs.gitShaMetadata }}"
shell: bash

View File

@@ -0,0 +1,67 @@
#!/bin/bash
MAJOR="$1"
MINOR="$2"
PATCH="$3"
REVISION="$4"
SUFFIX="$5"
METADATA="$6"
INCREMENT_MODE="${7:-default}"
GIT_SHA_METADATA="$8"
if [[ ! -f "$GITHUB_OUTPUT" ]]; then
# Write to stdout if the output file doesn't exist.
GITHUB_OUTPUT="/dev/fd/1"
fi
NEXT_MAJOR=$((MAJOR + 1))
NEXT_MINOR=$((MINOR + 1))
NEXT_PATCH=$((PATCH + 1))
NEXT_REVISION=$((REVISION + 1))
NEXT_SUFFIX="$SUFFIX"
NEXT_METADATA="$METADATA"
if [[ "$GIT_SHA_METADATA" == "true" ]]; then
NEXT_METADATA="$GITHUB_SHA"
fi
echo "nextMajor=$NEXT_MAJOR" >> "$GITHUB_OUTPUT"
echo "nextMinor=$NEXT_MINOR" >> "$GITHUB_OUTPUT"
echo "nextPatch=$NEXT_PATCH" >> "$GITHUB_OUTPUT"
echo "nextRevision=$NEXT_REVISION" >> "$GITHUB_OUTPUT"
echo "nextSuffix=$NEXT_SUFFIX" >> "$GITHUB_OUTPUT"
echo "nextMetadata=$NEXT_METADATA" >> "$GITHUB_OUTPUT"
# This script assumes that thre version numbers is the desired default format.
NEXT_VERSION="${MAJOR:-0}.${MINOR:-0}"
if [[ "$INCREMENT_MODE" == "default" ]]; then
if [[ -n "$REVISION" ]]; then
NEXT_VERSION="$NEXT_VERSION.${PATCH:-0}.$NEXT_REVISION"
elif [[ -n "$PATCH" ]]; then
NEXT_VERSION="$NEXT_VERSION.$NEXT_PATCH"
elif [[ -n "$MINOR" ]]; then
NEXT_VERSION="${MAJOR:-0}.$NEXT_MINOR.0"
else
NEXT_VERSION="$NEXT_MAJOR.0.0"
fi
elif [[ "$INCREMENT_MODE" == "major" ]]; then
NEXT_VERSION="$NEXT_MAJOR.0.0"
elif [[ "$INCREMENT_MODE" == "minor" ]]; then
NEXT_VERSION="${MAJOR:-0}.$NEXT_MINOR.0"
elif [[ "$INCREMENT_MODE" == "patch" ]]; then
NEXT_VERSION="${MAJOR:-0}.${MINOR:-0}.$NEXT_PATCH"
elif [[ "$INCREMENT_MODE" == "revision" ]]; then
NEXT_VERSION="${MAJOR:-0}.${MINOR:-0}.${PATCH:-0}.$NEXT_REVISION"
else
echo "Invalid increment mode: $INCREMENT_MODE"
exit 1
fi
if [[ -n "$NEXT_SUFFIX" ]]; then
NEXT_VERSION="$NEXT_VERSION-$NEXT_SUFFIX"
fi
if [[ -n "$NEXT_METADATA" ]]; then
NEXT_VERSION="$NEXT_VERSION+$NEXT_METADATA"
fi
echo "nextVersion=$NEXT_VERSION" >> "$GITHUB_OUTPUT"