diff --git a/.github/workflows/_get-version-workflow.yml b/.github/workflows/_get-version-workflow.yml new file mode 100644 index 0000000000..755dbaa1fd --- /dev/null +++ b/.github/workflows/_get-version-workflow.yml @@ -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 }} diff --git a/.github/workflows/dev_builds.yml b/.github/workflows/dev_builds.yml index 6b07e1b2dd..ce34024609 100644 --- a/.github/workflows/dev_builds.yml +++ b/.github/workflows/dev_builds.yml @@ -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: @@ -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 diff --git a/.github/workflows/pull_requests.yml b/.github/workflows/pull_requests.yml index a1069b2825..e00ddae670 100644 --- a/.github/workflows/pull_requests.yml +++ b/.github/workflows/pull_requests.yml @@ -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: @@ -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: