@@ -113,112 +113,112 @@ jobs:
113113 echo "IS_HOTFIX=${{ env.IS_HOTFIX }}" | tee -a "$GITHUB_OUTPUT"
114114 echo "LATEST_TAG=${{ env.LATEST_TAG }}" | tee -a "$GITHUB_OUTPUT"
115115
116- check-package-version :
117- needs : get-versions
118- if : github.event_name == 'pull_request' && needs.get-versions.outputs.IS_RELEASE_BRANCH == 'True'
119- outputs :
120- release_version : ${{ steps.create_release.outputs.current_tag }}
121- release_url : ${{ steps.create_release.outputs.upload_url }}
122- update_version : ${{ steps.check_version.outputs.update_version }}
123- next_version : ${{ steps.set-semver-info.outputs.new_version }}
124- runs-on : ubuntu-latest
125- steps :
126- - name : Check out the code
127- uses : actions/checkout@v3
128- - run : |
129- echo "INC_LEVEL=${{ needs.get-versions.outputs.INC_LEVEL}}"
130- - name : Check if initial release
131- if : needs.get-versions.outputs.LATEST_TAG == ''
132- run : |
133- echo "INITIAL_VERSION=${{needs.get-versions.outputs.PR_BASE_TAG}}.0-rc.0" | tee -a "$GITHUB_STEP_SUMMARY" | tee -a "$GITHUB_ENV"
134- echo "MANUAL_VERSION=${{needs.get-versions.outputs.PR_BASE_TAG}}.0-rc.0" | tee -a "$GITHUB_ENV"
135- - name : Set semver info
136- id : set-semver-info
137- if : needs.get-versions.outputs.LATEST_TAG != ''
138- uses : fiddlermikey/action-bump-semver@main
139- with :
140- current_version : ${{ needs.get-versions.outputs.LATEST_TAG}}
141- level : ${{ needs.get-versions.outputs.INC_LEVEL}}
142- preID : rc
143- - name : Show next sem-version
144- if : needs.get-versions.outputs.LATEST_TAG != ''
145- run : |
146- echo "MANUAL_VERSION=${{ steps.set-semver-info.outputs.new_version }}" > "$GITHUB_ENV"
147- - run : |
148- echo "Next version: ${{ env.MANUAL_VERSION }}" | tee -a "$GITHUB_STEP_SUMMARY"
149-
150- - name : Get Package Version
151- id : get-pkg-version
152- run : |
153- pwd
154- ls -la
155- echo "CURRENT_PKG_VERSION=$(cat pkg/version/version.go | grep 'const VERSION' | awk '{print $NF}' | tr -d '"')" | tee -a "$GITHUB_ENV"
156- - name : Compare package version
157- id : check_version
158- run : |
159- if [ "${{ env.CURRENT_PKG_VERSION }}" != "${{ env.MANUAL_VERSION }}" ]; then
160- echo "Updating version in version.go"
161- echo "update_version=true" | tee -a $GITHUB_ENV | tee -a $GITHUB_OUTPUT
162- echo "update_version=true" | tee -a "$GITHUB_STEP_SUMMARY"
163- else
164- echo "Versions match, no update needed"
165- echo "update_version=false" | tee -a $GITHUB_ENV | tee -a $GITHUB_OUTPUT
166- echo "update_version=false" | tee -a $GITHUB_STEP_SUMMARY
167- fi
168- env :
169- UPDATE_VERSION : ${{ steps.check_version.outputs.update_version }}
170-
171- - name : Set Outputs
172- id : set-outputs
173- if : needs.get-versions.outputs.LATEST_TAG != ''
174- run : |
175- echo "UPDATE_VERSION=${{ steps.check_version.outputs.update_version }}" | tee -a "$GITHUB_OUTPUT"
176- echo "CURRENT_PKG_VERSION=${{ env.CURRENT_PKG_VERSION }}" | tee -a "$GITHUB_OUTPUT"
177- echo "MANUAL_VERSION=${{ env.MANUAL_VERSION }}" | tee -a "$GITHUB_OUTPUT"
178- echo "NEW_PKG_VERSION=${{ env.MANUAL_VERSION }}" | tee -a "$GITHUB_OUTPUT"
179-
180- update-pkg-version :
181- needs :
182- - check-package-version
183- runs-on : ubuntu-latest
184-
185- steps :
186- - name : Checkout repository
187- uses : actions/checkout@v3
188- with :
189- token : ${{ secrets.V2BUILDTOKEN}}
190- - name : No Update
191- if : ${{ needs.check-package-version.outputs.update_version != 'true' }}
192- run : |
193- echo "Versions match, no update needed"
194- exit 0
195-
196- - name : Commit to PR branch
197- id : commit-version
198- if : ${{ needs.check-package-version.outputs.update_version == 'true' }}
199- env :
200- 201- AUTHOR_NAME : Keyfactor Robot
202- GITHUB_TOKEN : ${{ secrets.V2BUILDTOKEN}}
203- run : |
204- git remote -v
205- echo "Checking out ${{ github.head_ref }}"
206- git fetch
207- echo "git checkout -b ${{ github.head_ref }}"
208- git checkout -b ${{ github.head_ref }}
209- git reset --hard origin/${{ github.head_ref }}
210- sed -i "s/const VERSION = .*/const VERSION = \"${{ needs.check-package-version.outputs.next_version }}\"/" pkg/version/version.go
211- git add pkg/version/version.go
212- git config --global user.email "${{ env.AUTHOR_EMAIL }}"
213- git config --global user.name "${{ env.AUTHOR_NAME }}"
214- git commit -m "Bump package version to ${{ needs.check-package-version.outputs.next_version }}"
215- git push --set-upstream origin ${{ github.head_ref }}
216- echo "Version mismatch! Please create a new pull request with the updated version."
217- exit 1
116+ # check-package-version:
117+ # needs: get-versions
118+ # if: github.event_name == 'pull_request' && needs.get-versions.outputs.IS_RELEASE_BRANCH == 'True'
119+ # outputs:
120+ # release_version: ${{ steps.create_release.outputs.current_tag }}
121+ # release_url: ${{ steps.create_release.outputs.upload_url }}
122+ # update_version: ${{ steps.check_version.outputs.update_version }}
123+ # next_version: ${{ steps.set-semver-info.outputs.new_version }}
124+ # runs-on: ubuntu-latest
125+ # steps:
126+ # - name: Check out the code
127+ # uses: actions/checkout@v3
128+ # - run: |
129+ # echo "INC_LEVEL=${{ needs.get-versions.outputs.INC_LEVEL}}"
130+ # - name: Check if initial release
131+ # if: needs.get-versions.outputs.LATEST_TAG == ''
132+ # run: |
133+ # echo "INITIAL_VERSION=${{needs.get-versions.outputs.PR_BASE_TAG}}.0-rc.0" | tee -a "$GITHUB_STEP_SUMMARY" | tee -a "$GITHUB_ENV"
134+ # echo "MANUAL_VERSION=${{needs.get-versions.outputs.PR_BASE_TAG}}.0-rc.0" | tee -a "$GITHUB_ENV"
135+ # - name: Set semver info
136+ # id: set-semver-info
137+ # if: needs.get-versions.outputs.LATEST_TAG != ''
138+ # uses: fiddlermikey/action-bump-semver@main
139+ # with:
140+ # current_version: ${{ needs.get-versions.outputs.LATEST_TAG}}
141+ # level: ${{ needs.get-versions.outputs.INC_LEVEL}}
142+ # preID: rc
143+ # - name: Show next sem-version
144+ # if: needs.get-versions.outputs.LATEST_TAG != ''
145+ # run: |
146+ # echo "MANUAL_VERSION=${{ steps.set-semver-info.outputs.new_version }}" > "$GITHUB_ENV"
147+ # - run: |
148+ # echo "Next version: ${{ env.MANUAL_VERSION }}" | tee -a "$GITHUB_STEP_SUMMARY"
149+ #
150+ # - name: Get Package Version
151+ # id: get-pkg-version
152+ # run: |
153+ # pwd
154+ # ls -la
155+ # echo "CURRENT_PKG_VERSION=$(cat pkg/version/version.go | grep 'const VERSION' | awk '{print $NF}' | tr -d '"')" | tee -a "$GITHUB_ENV"
156+ # - name: Compare package version
157+ # id: check_version
158+ # run: |
159+ # if [ "${{ env.CURRENT_PKG_VERSION }}" != "${{ env.MANUAL_VERSION }}" ]; then
160+ # echo "Updating version in version.go"
161+ # echo "update_version=true" | tee -a $GITHUB_ENV | tee -a $GITHUB_OUTPUT
162+ # echo "update_version=true" | tee -a "$GITHUB_STEP_SUMMARY"
163+ # else
164+ # echo "Versions match, no update needed"
165+ # echo "update_version=false" | tee -a $GITHUB_ENV | tee -a $GITHUB_OUTPUT
166+ # echo "update_version=false" | tee -a $GITHUB_STEP_SUMMARY
167+ # fi
168+ # env:
169+ # UPDATE_VERSION: ${{ steps.check_version.outputs.update_version }}
170+ #
171+ # - name: Set Outputs
172+ # id: set-outputs
173+ # if: needs.get-versions.outputs.LATEST_TAG != ''
174+ # run: |
175+ # echo "UPDATE_VERSION=${{ steps.check_version.outputs.update_version }}" | tee -a "$GITHUB_OUTPUT"
176+ # echo "CURRENT_PKG_VERSION=${{ env.CURRENT_PKG_VERSION }}" | tee -a "$GITHUB_OUTPUT"
177+ # echo "MANUAL_VERSION=${{ env.MANUAL_VERSION }}" | tee -a "$GITHUB_OUTPUT"
178+ # echo "NEW_PKG_VERSION=${{ env.MANUAL_VERSION }}" | tee -a "$GITHUB_OUTPUT"
179+ #
180+ # update-pkg-version:
181+ # needs:
182+ # - check-package-version
183+ # runs-on: ubuntu-latest
184+ #
185+ # steps:
186+ # - name: Checkout repository
187+ # uses: actions/checkout@v3
188+ # with:
189+ # token: ${{ secrets.V2BUILDTOKEN}}
190+ # - name: No Update
191+ # if: ${{ needs.check-package-version.outputs.update_version != 'true' }}
192+ # run: |
193+ # echo "Versions match, no update needed"
194+ # exit 0
195+ #
196+ # - name: Commit to PR branch
197+ # id: commit-version
198+ # if: ${{ needs.check-package-version.outputs.update_version == 'true' }}
199+ # env:
200+ 201+ # AUTHOR_NAME: Keyfactor Robot
202+ # GITHUB_TOKEN: ${{ secrets.V2BUILDTOKEN}}
203+ # run: |
204+ # git remote -v
205+ # echo "Checking out ${{ github.head_ref }}"
206+ # git fetch
207+ # echo "git checkout -b ${{ github.head_ref }}"
208+ # git checkout -b ${{ github.head_ref }}
209+ # git reset --hard origin/${{ github.head_ref }}
210+ # sed -i "s/const VERSION = .*/const VERSION = \"${{ needs.check-package-version.outputs.next_version }}\"/" pkg/version/version.go
211+ # git add pkg/version/version.go
212+ # git config --global user.email "${{ env.AUTHOR_EMAIL }}"
213+ # git config --global user.name "${{ env.AUTHOR_NAME }}"
214+ # git commit -m "Bump package version to ${{ needs.check-package-version.outputs.next_version }}"
215+ # git push --set-upstream origin ${{ github.head_ref }}
216+ # echo "Version mismatch! Please create a new pull request with the updated version."
217+ # exit 1
218218
219219 call-starter-workflow :
220220 uses : keyfactor/actions/.github/workflows/starter.yml@v2
221- needs : update-pkg-version
221+ needs : get-versions
222222 secrets :
223223 token : ${{ secrets.V2BUILDTOKEN}}
224224 APPROVE_README_PUSH : ${{ secrets.APPROVE_README_PUSH}}
0 commit comments