-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #69 from chizovation/fix-version-updater
Fix version updater
- Loading branch information
Showing
2 changed files
with
56 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'changesets-changelog-info': patch | ||
--- | ||
|
||
fix: update 'update-doc-version' workflow to latest good version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,55 +3,91 @@ name: Update Doc Version | |
|
||
# yamllint disable-line rule:truthy | ||
on: | ||
# this is the trigger that really does the work | ||
push: | ||
tags: | ||
- v* | ||
workflow_dispatch: | ||
# pull_request is only here to check the behaviour without needing to merge | ||
# all the time | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
readme-versions: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Setup Git User | ||
uses: fregante/setup-git-user@v2 | ||
|
||
# we use ourself to get the information for the release | ||
- name: Get Change Info | ||
uses: ./ | ||
uses: chizovation/[email protected] | ||
id: get-changelog-info | ||
|
||
- name: Update Version In Files | ||
- name: Prepare Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.11 | ||
|
||
- name: Bumpversion deps | ||
shell: bash | ||
# yamllint disable rule:line-length | ||
run: | | ||
latest_version="${{ steps.get-changelog-info.outputs.last-change-version-v }}" | ||
files="README.md" | ||
# replace the version "latest-v0.0.4-blue" with the latest | ||
sed -i "s/latest-v.*-blue/latest-${latest_version}-blue/g" $files | ||
pip install --no-cache-dir -U pip | ||
pip install --no-cache-dir bumpversion | ||
# update any doc references to ourself; chizovation/[email protected] | ||
sed -i "s/chizmw\/changesets-changelog-info@v.*/chizmw\/changesets-changelog-info@${latest_version}/g" $files | ||
- name: Run Bumpversion | ||
shell: bash | ||
# yamllint disable rule:line-length | ||
run: | | ||
export current_version="${{ steps.get-changelog-info.outputs.last-change-version }}" | ||
bumpversion --verbose \ | ||
--allow-dirty \ | ||
--no-commit \ | ||
--no-tag \ | ||
--message "chore: update version in files (${current_version})" \ | ||
--new-version "${current_version}" \ | ||
patch | ||
# yamllint enable rule:line-length | ||
|
||
- name: Debug Commits and Current Branch | ||
run: | | ||
echo "Commits:" | ||
echo "====================" | ||
git log --oneline --decorate --graph -n 10 | ||
echo "Current Branch:" | ||
echo "====================" | ||
git branch --show-current | ||
echo "Default Branch:" | ||
echo "====================" | ||
echo "${{ github.event.repository.default_branch }}" | ||
echo "last-change-version" | ||
echo "====================" | ||
echo "${{ steps.get-changelog-info.outputs.last-change-version }}" | ||
echo "git diff" | ||
echo "====================" | ||
git diff | ||
- name: Create Pull Request | ||
id: create-pr | ||
uses: peter-evans/create-pull-request@v5 | ||
if: startsWith(github.ref, 'refs/tags/v') | ||
with: | ||
# yamllint disable rule:line-length | ||
title: 'chore: update version in files (${{ steps.get-changelog-info.outputs.last-change-version-v}})' | ||
commit-message: | | ||
chore: update version in files (${{ steps.get-changelog-info.outputs.last-change-version-v}}) | ||
[skip ci] | ||
title: 'chore: update version in files (${{ steps.get-changelog-info.outputs.last-change-version}})' | ||
commit-message: 'chore: update version in files (${{ steps.get-changelog-info.outputs.last-change-version}}) [skip ci]' | ||
base: ${{ github.event.repository.default_branch }} | ||
delete-branch: true | ||
token: ${{ secrets.CHANGESETS_TOKEN }} | ||
# yamllint enable rule:line-length | ||
|
||
- uses: peter-evans/enable-pull-request-automerge@v3 | ||
if: startsWith(github.ref, 'refs/tags/v') | ||
with: | ||
# yamllint disable rule:line-length | ||
token: ${{ secrets.CHANGESETS_TOKEN }} | ||
|