Skip to content

Commit c36c364

Browse files
authored
ci: fix release branch pipelines and blocked org actions (#548)
1 parent f5859e2 commit c36c364

6 files changed

Lines changed: 44 additions & 38 deletions

File tree

.github/scripts/release.sh

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,13 +131,10 @@ if [ -z "$DRYRUN" ]; then
131131
BUMP_BRANCH="automated/bump-${CANDIDATE//./-}"
132132
git checkout -b "$BUMP_BRANCH"
133133
git push --set-upstream origin "$BUMP_BRANCH"
134-
BUMP_PR_URL=$(gh pr create \
135-
--title "[Automated] Bump dev version to ${CANDIDATE}" \
136-
--body "Automated version bump after releasing v${BASE}. Please review and merge." \
137-
--base "$BRANCH" \
138-
--head "$BUMP_BRANCH")
134+
REPO="${GITHUB_REPOSITORY:-$(git remote get-url origin | sed 's|.*github.com[:/]\(.*\)\.git|\1|')}"
135+
BUMP_PR_URL="https://github.com/${REPO}/compare/${BRANCH}...${BUMP_BRANCH}?quick_pull=1&title=%5BAutomated%5D+Bump+dev+version+to+${CANDIDATE}"
139136
echo "BUMP_PR_URL=$BUMP_PR_URL" >> "${GITHUB_OUTPUT:-/dev/null}"
140-
echo "Version bump PR requires manual approval: $BUMP_PR_URL"
137+
echo "Open this URL to create the version bump PR: $BUMP_PR_URL"
141138
else
142139
git push $DRYRUN --atomic --set-upstream origin $BRANCH
143140
fi

.github/workflows/gh_release.yml

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -26,30 +26,34 @@ jobs:
2626
if: (startsWith(github.event.ref, 'refs/tags/v_') || inputs.release_tag != '') && !endsWith(github.event.ref, '-SNAPSHOT')
2727
runs-on: ubuntu-latest
2828
steps:
29-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
30-
with:
31-
fetch-depth: 0
32-
- uses: webfactory/ssh-agent@e83874834305fe9a4a2997156cb26c5de65a8555 # v0.10.0
33-
with:
34-
ssh-private-key: ${{ secrets.SSH_PUSH_SECRET }}
3529
- name: Create Release [automatic]
3630
id: create_release_auto
37-
uses: ncipollo/release-action@339a81892b84b4eeb0f6e744e4574d79d0d9b8dd # v1.21.0
3831
if: ${{ startsWith(github.ref, 'refs/tags/') }}
39-
with:
40-
generateReleaseNotes: true
41-
allowUpdates: true
42-
draft: true
4332
env:
4433
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
GH_REPO: ${{ github.repository }}
35+
run: |
36+
if gh release view "${GITHUB_REF_NAME}" >/dev/null 2>&1; then
37+
gh release edit "${GITHUB_REF_NAME}" --draft
38+
else
39+
gh release create "${GITHUB_REF_NAME}" \
40+
--title "${GITHUB_REF_NAME}" \
41+
--generate-notes \
42+
--draft
43+
fi
4544
- name: Create Release [manual]
4645
id: create_release_manual
47-
uses: ncipollo/release-action@339a81892b84b4eeb0f6e744e4574d79d0d9b8dd # v1.21.0
4846
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
49-
with:
50-
generateReleaseNotes: true
51-
allowUpdates: true
52-
tag: ${{ inputs.release_tag}}
53-
draft: true
5447
env:
55-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49+
GH_REPO: ${{ github.repository }}
50+
run: |
51+
TAG="${{ inputs.release_tag }}"
52+
if gh release view "${TAG}" >/dev/null 2>&1; then
53+
gh release edit "${TAG}" --draft
54+
else
55+
gh release create "${TAG}" \
56+
--title "${TAG}" \
57+
--generate-notes \
58+
--draft
59+
fi

.github/workflows/release-validated.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ on:
2727
permissions:
2828
contents: write
2929
actions: read
30-
pull-requests: write
3130

3231
jobs:
3332
validate-inputs:

.github/workflows/update_assets.yml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,10 @@ jobs:
6060
mv ${LIB_BASE_DIR}/linux-x64-musl/libjavaProfiler.so assets/libjavaProfiler_linux-x64-musl.so
6161
- name: Update release ${{ inputs.release_tag }}
6262
id: update-release
63-
uses: ncipollo/release-action@339a81892b84b4eeb0f6e744e4574d79d0d9b8dd # v1.21.0
64-
with:
65-
token: ${{ secrets.GITHUB_TOKEN }}
66-
tag: "v_${{ env.VERSION }}"
67-
allowUpdates: true
68-
generateReleaseNotes: true
69-
omitBodyDuringUpdate: true
70-
artifacts: assets/ddprof*.jar,assets/*.so
71-
draft: false
72-
makeLatest: true
63+
env:
64+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
65+
GH_REPO: ${{ github.repository }}
66+
run: |
67+
TAG="v_${VERSION}"
68+
gh release upload "${TAG}" assets/ddprof*.jar assets/*.so --clobber
69+
gh release edit "${TAG}" --draft=false --latest

.gitlab/build-deploy/.gitlab-ci.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,10 @@ build-artifact:
217217
- job: gtest-tsan-arm64
218218
artifacts: false
219219
optional: true
220-
when: on_success
220+
rules:
221+
- if: '$CI_COMMIT_BRANCH =~ /^release\//'
222+
when: never
223+
- when: on_success
221224
tags: [ "arch:amd64" ]
222225
image: ${BUILD_IMAGE_X64}
223226

@@ -250,7 +253,10 @@ deploy-artifact:
250253
artifacts: true
251254
- job: build:arm64-musl
252255
artifacts: true
253-
when: on_success
256+
rules:
257+
- if: '$CI_COMMIT_BRANCH =~ /^release\//'
258+
when: never
259+
- when: on_success
254260
tags: [ "arch:amd64" ]
255261
image: ${BUILD_IMAGE_X64}
256262

.gitlab/scripts/prepare.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ export CI_COMMIT_BRANCH
1111
# Allow: default branch pushes, scheduled runs, and web (manual) triggers
1212
# Gate: push/trigger/pipeline sources on non-default branches must have an open GitHub PR
1313
if [ "${CI_PIPELINE_SOURCE}" == "push" ] || [ "${CI_PIPELINE_SOURCE}" == "trigger" ] || [ "${CI_PIPELINE_SOURCE}" == "pipeline" ]; then
14-
if [ -n "${CI_COMMIT_BRANCH}" ] && [ "${CI_COMMIT_BRANCH}" != "${CI_DEFAULT_BRANCH:-main}" ] && [[ ! ${CI_COMMIT_TAG} =~ ^v_[1-9][0-9]*\.[0-9]+\.[0-9]+(-SNAPSHOT)?$ ]]; then
14+
if [ -n "${CI_COMMIT_BRANCH}" ] && \
15+
[ "${CI_COMMIT_BRANCH}" != "${CI_DEFAULT_BRANCH:-main}" ] && \
16+
[[ ! ${CI_COMMIT_TAG} =~ ^v_[1-9][0-9]*\.[0-9]+\.[0-9]+(-SNAPSHOT)?$ ]] && \
17+
[[ ! ${CI_COMMIT_BRANCH} =~ ^release/[0-9]+\.[0-9]+\._$ ]]; then
1518
# Check if the branch has an open PR in DataDog/java-profiler
1619
API_RESPONSE=$(curl -sf "https://api.github.com/repos/DataDog/java-profiler/pulls?head=DataDog:${CI_COMMIT_BRANCH}&state=open&per_page=1" 2>/dev/null || echo "")
1720
if [ -n "${API_RESPONSE}" ] && ! echo "${API_RESPONSE}" | grep -q '"number"'; then

0 commit comments

Comments
 (0)