Skip to content

Commit

Permalink
simplify logic
Browse files Browse the repository at this point in the history
Signed-off-by: Justin Kolberg <[email protected]>
  • Loading branch information
amdprophet committed Nov 8, 2024
1 parent 5fbd71d commit 6ca5f0e
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 38 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/_get-version-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Get next available version

on:
workflow_call:
outputs:
version:
description: "The next unused version to use"
value: ${{ jobs.get-version.outputs.version }}

get-version:
name: Get application version for this revision
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get-version.outputs.version }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Get version
id: get-version
run: |
version=$(./ci/get_version.sh full | xargs)-$(git rev-parse HEAD | xargs)
echo "version=${version}" > $GITHUB_OUTPUT
- name: Print version
run: echo ::notice title=Version::${{ steps.get-version.outputs.version }}
23 changes: 4 additions & 19 deletions .github/workflows/dev_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,6 @@ env:
GO_VERSION: "1.22.6"

jobs:
get-version:
name: Get application version for this revision
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get-version.outputs.version }}
steps:
- uses: actions/checkout@v4
with:
fetch-tags: true

- name: Get version
id: get-version
run: |
version=$(./ci/get_version.sh full | xargs)-$(git rev-parse HEAD | xargs)
echo "version=${version}" > $GITHUB_OUTPUT
- name: Print version
run: echo ::notice title=Version::${{ steps.get-version.outputs.version }}

# Add lint to dev builds as that's the only way for cache to be shared across branches.
# https://docs.github.com/en/actions/advanced-guides/caching-dependencies-to-speed-up-workflows#matching-a-cache-key
lint:
Expand Down Expand Up @@ -121,6 +102,10 @@ jobs:
save-cache: true
boringcrypto: ${{ matrix.boringcrypto == true }}

get-version:
name: Get next available version
uses: ./.github/workflows/_get-version-workflow.yml

build:
name: Build
uses: ./.github/workflows/workflow-build.yml
Expand Down
24 changes: 5 additions & 19 deletions .github/workflows/pull_requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,6 @@ jobs:
**/Makefile.common
**/Dockerfile*
get-version:
name: Get application version for this revision
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get-version.outputs.version }}
steps:
- uses: actions/checkout@v4
with:
fetch-tags: true

- name: Get version
id: get-version
run: |
version=$(./ci/get_version.sh full | xargs)-$(git rev-parse HEAD | xargs)
echo "version=${version}" > $GITHUB_OUTPUT
- name: Print version
run: echo ::notice title=Version::${{ steps.get-version.outputs.version }}

markdownlint:
runs-on: ubuntu-20.04
steps:
Expand Down Expand Up @@ -242,9 +223,14 @@ jobs:
- name: Run staticcheck
run: make golint

get-version:
name: Get next available version
uses: ./.github/workflows/_get-version-workflow.yml

build:
name: Build
uses: ./.github/workflows/workflow-build.yml
needs: [get-version]
strategy:
matrix:
include:
Expand Down

0 comments on commit 6ca5f0e

Please sign in to comment.