Skip to content

Commit f73cd80

Browse files
committed
ci: simplify publish check
1 parent e35c8fb commit f73cd80

File tree

1 file changed

+52
-27
lines changed

1 file changed

+52
-27
lines changed

.github/workflows/build.yaml

Lines changed: 52 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -15,30 +15,54 @@ on:
1515

1616
jobs:
1717

18-
version:
19-
name: check version
18+
check-publish:
19+
name: check publish
2020
runs-on: ubuntu-latest
2121
outputs:
2222
BUILD_VERSION: ${{ env.BUILD_VERSION }}
23+
BUILD_SNAPSHOT: ${{ env.BUILD_SNAPSHOT }}
24+
BUILD_PUBLISH: ${{ env.BUILD_PUBLISH }}
2325

2426
steps:
25-
- name: Set up Homebrew
26-
id: set-up-homebrew
27-
uses: Homebrew/actions/setup-homebrew@master
28-
29-
- name: checkout
30-
uses: actions/checkout@v6
31-
32-
- name: install dasel
27+
- name: get version
28+
id: get-version
29+
uses: openapi-processor/openapi-processor-base/.github/actions/version@main
30+
with:
31+
version-file: 'gradle/libs.versions.toml'
32+
version-path: 'versions.openapiparser'
33+
34+
- name: set version outputs
35+
shell: bash
3336
run: |
34-
brew install dasel
37+
echo BUILD_VERSION="${{steps.get-version.outputs.version}}" >> $GITHUB_ENV
38+
echo BUILD_SNAPSHOT="${{steps.get-version.outputs.snapshot}}" >> $GITHUB_ENV
39+
echo BUILD_PUBLISH="${{steps.get-version.outputs.publish}}" >> $GITHUB_ENV
3540
cat $GITHUB_ENV
3641
37-
- name: extract version
38-
run: |
39-
version=`cat gradle/libs.versions.toml | dasel -i toml 'versions.openapiparser'`
40-
echo "BUILD_VERSION=${version#projectVersion=}" >> $GITHUB_ENV
41-
cat $GITHUB_ENV
42+
# version:
43+
# name: check version
44+
# runs-on: ubuntu-latest
45+
# outputs:
46+
# BUILD_VERSION: ${{ env.BUILD_VERSION }}
47+
#
48+
# steps:
49+
# - name: Set up Homebrew
50+
# id: set-up-homebrew
51+
# uses: Homebrew/actions/setup-homebrew@master
52+
#
53+
# - name: checkout
54+
# uses: actions/checkout@v6
55+
#
56+
# - name: install dasel
57+
# run: |
58+
# brew install dasel
59+
# cat $GITHUB_ENV
60+
#
61+
# - name: extract version
62+
# run: |
63+
# version=`cat gradle/libs.versions.toml | dasel -i toml 'versions.openapiparser'`
64+
# echo "BUILD_VERSION=${version#projectVersion=}" >> $GITHUB_ENV
65+
# cat $GITHUB_ENV
4266

4367
test:
4468
name: test
@@ -76,23 +100,24 @@ jobs:
76100
name: test-results-${{ matrix.os }}
77101
path: '*/build/reports'
78102

79-
check-publish:
80-
needs: [version, test]
81-
name: check publish
82-
83-
runs-on: ubuntu-latest
84-
if: >-
85-
github.actor != 'dependabot[bot]' &&
86-
github.actor == 'hauner' && contains(needs.version.outputs.BUILD_VERSION, 'SNAPSHOT')
87-
88-
steps:
89-
- run: echo "should publish ..."
103+
# check-publish:
104+
# needs: [version, test]
105+
# name: check publish
106+
#
107+
# runs-on: ubuntu-latest
108+
# if: >-
109+
# github.actor != 'dependabot[bot]' &&
110+
# github.actor == 'hauner' && contains(needs.version.outputs.BUILD_VERSION, 'SNAPSHOT')
111+
#
112+
# steps:
113+
# - run: echo "should publish ..."
90114

91115
publish:
92116
needs: [check-publish]
93117
name: publish snapshot
94118

95119
runs-on: ubuntu-latest
120+
if: needs.check-publish.outputs.BUILD_PUBLISH == 'true'
96121

97122
steps:
98123
- name: checkout

0 commit comments

Comments
 (0)