diff --git a/.github/workflows/cut-release.yaml b/.github/workflows/cut-release.yaml index 93796d4..0e4edef 100644 --- a/.github/workflows/cut-release.yaml +++ b/.github/workflows/cut-release.yaml @@ -1,4 +1,4 @@ -name: Cut release +name: Cut Release on: workflow_dispatch: @@ -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 }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 3918ea0..423d0d5 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,4 +1,4 @@ -name: Release binaries +name: Release Binaries on: push: @@ -6,31 +6,8 @@ on: - "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 diff --git a/Makefile b/Makefile index bbfa37e..7d67a0a 100644 --- a/Makefile +++ b/Makefile @@ -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)