name: Bump Version on: workflow_dispatch: inputs: component: description: 'Version component to bump' required: true type: choice options: - minor - major jobs: bump: runs-on: docker permissions: contents: write steps: - name: Checkout code run: | git clone --depth 1 https://${{ gitea.actor }}:${{ gitea.token }}@gitea.ivangodwin.com/${{ gitea.repository }}.git . - name: Compute and push new version tag run: | git fetch --tags LATEST=$(git tag --sort=-v:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | head -1 || true) if [ -z "$LATEST" ]; then if [ "${{ inputs.component }}" = "major" ]; then VERSION="v1.0.0" else VERSION="v0.1.0" fi else MAJOR=$(echo "$LATEST" | cut -d. -f1 | tr -d 'v') MINOR=$(echo "$LATEST" | cut -d. -f2) if [ "${{ inputs.component }}" = "major" ]; then VERSION="v$((MAJOR + 1)).0.0" else VERSION="v${MAJOR}.$((MINOR + 1)).0" fi fi echo "Bumping to ${VERSION}" git tag "$VERSION" git push https://${{ gitea.actor }}:${{ gitea.token }}@gitea.ivangodwin.com/${{ gitea.repository }}.git "$VERSION"