Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

action(post-release): use fetch-depth, quoting and fix git commands #2205

Merged
merged 6 commits into from
Oct 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ on:
types: [published]

permissions:
contents: write
issues: write
contents: write
issues: write
pull-requests: write
Mpdreamz marked this conversation as resolved.
Show resolved Hide resolved

env:
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
Expand Down Expand Up @@ -127,18 +128,22 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
depth: 0
fetch-depth: 0

- name: Setup git config
uses: elastic/apm-pipeline-library/.github/actions/setup-git@current

- name: Create GitHub Pull Request if minor release.
run: |
echo "as long as there is a major.x branch"
existed_in_local=$(git ls-remote --heads origin ${TARGET_BRANCH})
if [ -z ${existed_in_local} ]; then
if [ -z "${existed_in_local}" ]; then
echo -e "::warning::Target branch '${TARGET_BRANCH}' does not exist."
exit 0
fi
git checkout ${TARGET_BRANCH} -b ${NEW_BRANCH}
git format-patch -k --stdout ${TARGET_BRANCH}...main -- docs CHANGELOG.asciidoc | git am -3 -k
git checkout $TARGET_BRANCH
git checkout -b ${NEW_BRANCH}
git format-patch -k --stdout ${TARGET_BRANCH}...origin/main -- docs CHANGELOG.asciidoc | git am -3 -k
Mpdreamz marked this conversation as resolved.
Show resolved Hide resolved
git push origin ${NEW_BRANCH}
gh pr create \
--title "post-release: ${GIT_TAG}" \
Expand All @@ -151,7 +156,7 @@ jobs:
run: |
echo "as long as there is no a major.x branch"
existed_in_local=$(git ls-remote --heads origin ${TARGET_BRANCH})
if [ -n ${existed_in_local} ]; then
if [ -n "${existed_in_local}" ]; then
echo -e "::warning::Target branch '${TARGET_BRANCH}' does exist."
exit 0
fi
Expand Down
Loading