File tree Expand file tree Collapse file tree 2 files changed +39
-0
lines changed
Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -76,11 +76,13 @@ jobs:
7676 cat changelog.json
7777 DESIRED_BRANCH="release/${LATEST_CHANGELOG_VERSION}"
7878 echo "DESIRED_BRANCH: ${DESIRED_BRANCH}"
79+ set +e
7980 git ls-remote \
8081 --exit-code \
8182 --heads \
8283 origin ${DESIRED_BRANCH} >/dev/null 2>&1
8384 EXIT_CODE=$?
85+ set -e
8486 echo "EXIT_CODE: ${EXIT_CODE}"
8587 if [[ ${EXIT_CODE} == '0' ]]; then
8688 echo "Git branch '${DESIRED_BRANCH}' exists on remote"
Original file line number Diff line number Diff line change 7373 name : dist_repo.${{ github.event.repository.name }}_sha.${{ github.sha }}_build.${{ github.run_number }}
7474 path : dist/*.tar.gz
7575 retention-days : 14
76+ - name : Test creation of release branch
77+ run : |
78+ git config user.name "github-actions"
79+ git config user.email "github-actions@github.com"
80+ LATEST_CHANGELOG_VERSION=$(jq -r '.info.version' changelog.json)
81+ echo "LATEST_CHANGELOG_VERSION: ${LATEST_CHANGELOG_VERSION}"
82+ echo "changelog.json file:"
83+ cat changelog.json
84+ DESIRED_BRANCH="release/${LATEST_CHANGELOG_VERSION}"
85+ echo "DESIRED_BRANCH: ${DESIRED_BRANCH}"
86+ set +e
87+ git ls-remote \
88+ --exit-code \
89+ --heads \
90+ origin ${DESIRED_BRANCH} >/dev/null 2>&1
91+ EXIT_CODE=$?
92+ set -e
93+ echo "EXIT_CODE: ${EXIT_CODE}"
94+ if [[ ${EXIT_CODE} == '0' ]]; then
95+ echo "Git branch '${DESIRED_BRANCH}' exists on remote"
96+ git checkout release/${LATEST_CHANGELOG_VERSION}
97+ elif [[ ${EXIT_CODE} == '2' ]]; then
98+ echo "Git branch '${DESIRED_BRANCH}' does not exist on remote"
99+ git checkout -b release/${LATEST_CHANGELOG_VERSION}
100+ fi
101+ git diff > diff.log
102+ echo "Diff in repo"
103+ cat diff.log
104+ if [[ $(git status --porcelain --untracked-files=no | wc -l) -gt 0 ]]; then
105+ echo "changed files available"
106+ git add package.json changelog.md be_upy_blink/version.py
107+ git status
108+ git commit -m "chore: files for release ${LATEST_CHANGELOG_VERSION}"
109+ git push -u origin release/${LATEST_CHANGELOG_VERSION}
110+ else
111+ echo "nothing new to commit and push"
112+ fi
76113 - name : Publish package
77114 uses : pypa/gh-action-pypi-publish@release/v1.13
78115 with :
You can’t perform that action at this time.
0 commit comments