Skip to content

Commit 198a107

Browse files
committed
[ci] Fix publish-release
- use own github app - fix asset filename Follow-up on #272 and #277
1 parent f074e2f commit 198a107

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

.ci/files/prepare_release_notes.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
set -e -o pipefail
2+
set -e +o pipefail
33

44
outfile="release_notes_prepared.md"
55
infile="ReleaseNotes.md"
@@ -11,7 +11,13 @@ fi
1111

1212

1313
# Extract the release notes.
14-
# Note: "|| test $? -eq 141" is added to ignore SIGPIPE errors when head finishes before grep is done.
14+
# Note: with "set +o pipefail", pipe errors are ignored. They might occur when
15+
# head finishes before grep is done.
16+
# Error message: "grep: write error: Broken pipe"
17+
#
18+
# Note2: "|| test $? -eq 141" is added to ignore SIGPIPE errors when head finishes before grep is done.
19+
# See https://stackoverflow.com/questions/22464786/ignoring-bash-pipefail-for-error-code-141
20+
# But that doesn't seem to work.
1521
BEGIN_LINE=$( (grep -n "^## " "${infile}" || test $? -eq 141) | head -1|cut -d ":" -f 1)
1622
END_LINE=$( (grep -n "^## " "${infile}" || test $? -eq 141) | head -2|tail -1|cut -d ":" -f 1)
1723
END_LINE=$((END_LINE - 1))

.github/workflows/publish-release.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,15 +145,23 @@ jobs:
145145
name: update-site
146146
- name: Prepare Release Notes
147147
run: .ci/files/prepare_release_notes.sh
148+
- uses: actions/create-github-app-token@v2
149+
id: pmd-actions-helper-app-token
150+
with:
151+
app-id: ${{ secrets.PMD_ACTIONS_HELPER_ID }}
152+
private-key: ${{ secrets.PMD_ACTIONS_HELPER_PRIVATE_KEY }}
153+
owner: pmd
154+
repositories: pmd-eclipse-plugin
155+
permission-contents: write # create a release
148156
- name: Create Release
149157
env:
150158
# Token required for GH CLI:
151-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
159+
GH_TOKEN: ${{ steps.pmd-actions-helper-app-token.outputs.token }}
152160
TAG_NAME: ${{ github.event.workflow_run.head_branch }}
153161
VERSION: ${{ needs.check-version.outputs.VERSION }}
154162
run: |
155163
RELEASE_NAME="PMD For Eclipse ${VERSION}"
156-
gh release create "$TAG_NAME" "net.sourceforge.pmd.eclipse.p2updatesite-${VERSION}.zip" \
164+
gh release create "$TAG_NAME" "net.sourceforge.pmd.eclipse.p2updatesite-${TAG_NAME}.zip" \
157165
--verify-tag \
158166
--notes-file release_notes_prepared.md \
159167
--title "$RELEASE_NAME"

0 commit comments

Comments
 (0)