Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 8 additions & 49 deletions .github/workflows/cut-release.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Cut release
name: Cut Release

on:
workflow_dispatch:
Expand All @@ -13,53 +13,12 @@ on:
- major

jobs:
tag:
runs-on: ubuntu-latest
cut-release:
uses: cloudoperators/common/.github/workflows/shared-release.yaml@main
permissions:
contents: write
actions: write
concurrency:
group: release-${{ github.repository }}
cancel-in-progress: false
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
fetch-depth: 0

- name: Compute new version
id: version
env:
BUMP: ${{ inputs.bump }}
run: |
CURRENT=$(git describe --tags --abbrev=0 2>/dev/null | sed 's/^v//' || echo "0.0.0")
echo "Current version: $CURRENT"

MAJOR=$(echo "$CURRENT" | cut -d. -f1)
MINOR=$(echo "$CURRENT" | cut -d. -f2)
PATCH=$(echo "$CURRENT" | cut -d. -f3)

case "$BUMP" in
major) MAJOR=$((MAJOR+1)); MINOR=0; PATCH=0 ;;
minor) MINOR=$((MINOR+1)); PATCH=0 ;;
patch) PATCH=$((PATCH+1)) ;;
esac

NEW="v${MAJOR}.${MINOR}.${PATCH}"
echo "New version: $NEW"
echo "tag=$NEW" >> "$GITHUB_OUTPUT"

- name: Create and push tag
env:
NEW_TAG: ${{ steps.version.outputs.tag }}
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -a "$NEW_TAG" -m "Release $NEW_TAG"
git push origin "$NEW_TAG"

- name: Trigger release workflow
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NEW_TAG: ${{ steps.version.outputs.tag }}
run: gh workflow run release.yaml --repo "$GITHUB_REPOSITORY" --ref "$NEW_TAG"
with:
bump: ${{ inputs.bump }}
makefile-path: Makefile
secrets:
release-token: ${{ secrets.GITHUB_TOKEN }}
Comment thread
onuryilmaz marked this conversation as resolved.
31 changes: 4 additions & 27 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,36 +1,13 @@
name: Release binaries
name: Release Binaries

on:
push:
tags:
- "v*"
workflow_dispatch:

permissions:
contents: write

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5
with:
go-version-file: go.mod
cache: true

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6
with:
# either 'goreleaser' (default) or 'goreleaser-pro'
distribution: goreleaser
# 'latest', 'v1.4.4' or a SemVer constraint
version: "~> v2"
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: cloudoperators/common/.github/workflows/shared-goreleaser.yaml@main
permissions:
contents: write
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ CMD_PKG ?= .
BUILD_DIR ?= bin

# Versioning (overridable)
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo dev)
VERSION ?= 2.0.1
GIT_COMMIT ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo unknown)
BUILD_DATE ?= $(shell date -u +%Y-%m-%dT%H:%M:%SZ)

Expand Down
Loading