From e3cf5a7e7a55d2909234ad9d9b5b8fdc690e1518 Mon Sep 17 00:00:00 2001 From: Matthew Buske Date: Mon, 6 Jan 2025 17:01:42 -0500 Subject: [PATCH] Pull Out Version Calculation Pull Out Version Calculation --- .github/workflows/create-release-tag.yml | 27 --------------------- .github/workflows/release-drafter.yml | 7 +++++- .github/workflows/version-calculation.yml | 29 +++++++++++++++++++++++ 3 files changed, 35 insertions(+), 28 deletions(-) delete mode 100644 .github/workflows/create-release-tag.yml create mode 100644 .github/workflows/version-calculation.yml diff --git a/.github/workflows/create-release-tag.yml b/.github/workflows/create-release-tag.yml deleted file mode 100644 index a7a6924..0000000 --- a/.github/workflows/create-release-tag.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Create Release Tag - -on: - pull_request: - branches: - - main - types: [closed] - -jobs: - create-tag: - if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/v') - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Create and Push Tag - run: | - # Extract version from branch name - BRANCH_NAME="${{ github.event.pull_request.head.ref }}" - VERSION=${BRANCH_NAME#release/} - - echo "Creating tag $VERSION from release branch $BRANCH_NAME" - - git tag $VERSION - git push origin $VERSION - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index 18bc55f..4055189 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -6,6 +6,11 @@ on: - staging workflow_call: inputs: + github-action-repo: + description: 'The Action Repository (If using a forked repository)' + required: false + type: string + default: 'deepworks-net/github.actions' draft: description: 'Create as draft release' required: false @@ -34,7 +39,7 @@ jobs: fetch-depth: 0 - name: Calculate Next Version - uses: ${{ github.action_path }}/actions/version_calculation@main + uses: ${{ inputs.github-action-repo }}/github.actions/actions/version_calculation@main id: version - name: Draft Release diff --git a/.github/workflows/version-calculation.yml b/.github/workflows/version-calculation.yml new file mode 100644 index 0000000..8dddbc6 --- /dev/null +++ b/.github/workflows/version-calculation.yml @@ -0,0 +1,29 @@ +name: Version Calculation + +on: + push: + branches: + - main # or master, depending on your default branch + workflow_dispatch: # allows manual triggering + workflow_call: + secrets: + token: + description: 'GitHub Repository Token' + required: false +jobs: + calculate-version: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 # Important: fetch all history and tags + + - name: Calculate next version + id: version + uses: deepworks-net/github.actions/actions/version-calculation@develop/122-re-work-actions-structure-for-external-use-and-consistency # Path to your local action + + # Optional: You can use the calculated version in subsequent steps + - name: Display calculated version + run: echo "Next version will be ${{ steps.version.outputs.next_version }}" \ No newline at end of file