Skip to content

Commit ef906a3

Browse files
stoyanK7romani
authored andcommitted
Issue #12840: Add repository owner environment variable in release process
1 parent 6eb8c6d commit ef906a3

12 files changed

+31
-17
lines changed

.ci/release-close-create-milestone.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,16 @@ set -e
55
source ./.ci/util.sh
66

77
checkForVariable "GITHUB_TOKEN"
8+
checkForVariable "REPOSITORY_OWNER"
89

910
echo "Close previous milestone at github"
1011
MILESTONE_NUMBER=$(curl --fail-with-body -s \
1112
-H "Authorization: token $GITHUB_TOKEN" \
12-
-X GET https://api.github.com/repos/checkstyle/checkstyle/milestones?state=open \
13+
-X GET https://api.github.com/repos/"$REPOSITORY_OWNER"/checkstyle/milestones?state=open \
1314
| jq ".[0] | .number")
1415
curl --fail-with-body -i -H "Authorization: token $GITHUB_TOKEN" \
1516
-d "{ \"state\": \"closed\" }" \
16-
-X PATCH https://api.github.com/repos/checkstyle/checkstyle/milestones/"$MILESTONE_NUMBER"
17+
-X PATCH https://api.github.com/repos/"$REPOSITORY_OWNER"/checkstyle/milestones/"$MILESTONE_NUMBER"
1718

1819

1920
echo "Creation of new milestone ..."
@@ -32,4 +33,4 @@ curl --fail-with-body -i -H "Authorization: token $GITHUB_TOKEN" \
3233
\"description\": \"\", \
3334
\"due_on\": \"$LAST_SUNDAY_DATETIME\" \
3435
}" \
35-
-X POST https://api.github.com/repos/checkstyle/checkstyle/milestones
36+
-X POST https://api.github.com/repos/"$REPOSITORY_OWNER"/checkstyle/milestones

.ci/release-create-issues-in-other-repos.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ set -e
55
source ./.ci/util.sh
66

77
checkForVariable "GITHUB_TOKEN"
8+
checkForVariable "REPOSITORY_OWNER"
89

910
if [[ -z $1 ]]; then
1011
echo "version is not set"
@@ -20,11 +21,11 @@ curl --fail-with-body -i -H "Authorization: token $GITHUB_TOKEN" \
2021
-d "{ \"title\": \"upgrade to checkstyle $TARGET_VERSION\", \
2122
\"body\": \"https://checkstyle.org/releasenotes.html#Release_$TARGET_VERSION\" \
2223
}" \
23-
-X POST https://api.github.com/repos/checkstyle/eclipse-cs/issues
24+
-X POST https://api.github.com/repos/"$REPOSITORY_OWNER"/eclipse-cs/issues
2425

2526
echo "Creation of issue in sonar-checkstyle repo ..."
2627
curl --fail-with-body -i -H "Authorization: token $GITHUB_TOKEN" \
2728
-d "{ \"title\": \"upgrade to checkstyle $TARGET_VERSION\", \
2829
\"body\": \"https://checkstyle.org/releasenotes.html#Release_$TARGET_VERSION\" \
2930
}" \
30-
-X POST https://api.github.com/repos/checkstyle/sonar-checkstyle/issues
31+
-X POST https://api.github.com/repos/"$REPOSITORY_OWNER"/sonar-checkstyle/issues

.ci/release-maven-perform.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ if [[ -z $1 ]]; then
1010
exit 1
1111
fi
1212

13+
checkForVariable "REPOSITORY_OWNER"
14+
1315
TARGET_VERSION=$1
1416
echo TARGET_VERSION="$TARGET_VERSION"
1517

@@ -21,6 +23,6 @@ SKIP_OTHERS="-Dpmd.skip=true -Dspotbugs.skip=true -Djacoco.skip=true -Dxml.skip=
2123
git checkout "checkstyle-$TARGET_VERSION"
2224
echo "Deploying jars to maven central (release:perform) ..."
2325
mvn -e --no-transfer-progress -Pgpg -Pgpgv2 release:perform \
24-
-DconnectionUrl=scm:git:https://github.com/checkstyle/checkstyle.git \
26+
-DconnectionUrl=scm:git:https://github.com/"$REPOSITORY_OWNER"/checkstyle.git \
2527
-Dtag=checkstyle-"$TARGET_VERSION" \
2628
-Darguments="$SKIP_TEST $SKIP_CHECKSTYLE $SKIP_OTHERS"

.ci/release-publish-releasenotes-twitter.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ checkForVariable "TWITTER_CONSUMER_SECRET"
88
checkForVariable "TWITTER_ACCESS_TOKEN"
99
checkForVariable "TWITTER_ACCESS_TOKEN_SECRET"
1010
checkForVariable "GITHUB_READ_ONLY_TOKEN"
11+
checkForVariable "REPOSITORY_OWNER"
1112

1213
checkout_from https://github.com/checkstyle/contribution
1314

@@ -23,13 +24,13 @@ if [ -d .ci-temp/checkstyle ]; then
2324
cd ../../
2425
else
2526
cd .ci-temp/
26-
git clone https://github.com/checkstyle/checkstyle
27+
git clone https://github.com/"$REPOSITORY_OWNER"/checkstyle
2728
cd ../
2829
fi
2930

3031
cd .ci-temp/checkstyle
3132

32-
curl --fail-with-body https://api.github.com/repos/checkstyle/checkstyle/releases \
33+
curl --fail-with-body https://api.github.com/repos/"$REPOSITORY_OWNER"/checkstyle/releases \
3334
-H "Authorization: token $GITHUB_READ_ONLY_TOKEN" \
3435
-o /var/tmp/cs-releases.json
3536

@@ -52,7 +53,7 @@ cd ../
5253
BUILDER_RESOURCE_DIR="contribution/releasenotes-builder/src/main/resources/com/github/checkstyle"
5354

5455
java -jar contribution/releasenotes-builder/target/releasenotes-builder-1.0-all.jar \
55-
-remoteRepoPath checkstyle/checkstyle \
56+
-remoteRepoPath "$REPOSITORY_OWNER"/checkstyle \
5657
-localRepoPath checkstyle \
5758
-startRef "$START_REF" \
5859
-endRef "$END_REF" \

.ci/release-update-github-page.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ TARGET_VERSION=$1
1212
echo TARGET_VERSION="$TARGET_VERSION"
1313

1414
checkForVariable "GITHUB_TOKEN"
15+
checkForVariable "REPOSITORY_OWNER"
1516

1617
checkout_from https://github.com/checkstyle/contribution
1718

@@ -27,13 +28,13 @@ if [ -d .ci-temp/checkstyle ]; then
2728
cd ../../
2829
else
2930
cd .ci-temp/
30-
git clone https://github.com/checkstyle/checkstyle
31+
git clone https://github.com/"$REPOSITORY_OWNER"/checkstyle
3132
cd ../
3233
fi
3334

3435
cd .ci-temp/checkstyle
3536

36-
curl --fail-with-body https://api.github.com/repos/checkstyle/checkstyle/releases \
37+
curl --fail-with-body https://api.github.com/repos/"$REPOSITORY_OWNER"/checkstyle/releases \
3738
-H "Authorization: token $GITHUB_TOKEN" \
3839
-o /var/tmp/cs-releases.json
3940

@@ -50,7 +51,7 @@ BUILDER_RESOURCE_DIR="contribution/releasenotes-builder/src/main/resources/com/g
5051

5152
java -jar contribution/releasenotes-builder/target/releasenotes-builder-1.0-all.jar \
5253
-localRepoPath checkstyle \
53-
-remoteRepoPath checkstyle/checkstyle \
54+
-remoteRepoPath "$REPOSITORY_OWNER"/checkstyle \
5455
-startRef "$START_REF" \
5556
-endRef "$END_REF" \
5657
-releaseNumber "$TARGET_VERSION" \
@@ -83,7 +84,7 @@ cat body.json
8384

8485
echo "Creating Github release"
8586
curl --fail-with-body \
86-
-X POST https://api.github.com/repos/checkstyle/checkstyle/releases \
87+
-X POST https://api.github.com/repos/"$REPOSITORY_OWNER"/checkstyle/releases \
8788
-H "Accept: application/vnd.github+json" \
8889
-H "Authorization: token $GITHUB_TOKEN" \
8990
--data @body.json

.ci/release-upload-all-jar.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ set -e
55
source ./.ci/util.sh
66

77
checkForVariable "GITHUB_TOKEN"
8+
checkForVariable "REPOSITORY_OWNER"
89

910
if [[ -z $1 ]]; then
1011
echo "version is not set"
@@ -21,10 +22,10 @@ echo "Generating uber jar ...(no clean to keep site resources just in case)"
2122
mvn -e --no-transfer-progress -Passembly,no-validations package
2223

2324
echo "Publishing 'all' jar to Github"
24-
UPLOAD_LINK=https://uploads.github.com/repos/checkstyle/checkstyle/releases
25+
UPLOAD_LINK=https://uploads.github.com/repos/"$REPOSITORY_OWNER"/checkstyle/releases
2526
RELEASE_ID=$(curl --fail-with-body -s -X GET \
2627
-H "Authorization: token $GITHUB_TOKEN" \
27-
https://api.github.com/repos/checkstyle/checkstyle/releases/tags/checkstyle-"$TARGET_VERSION" \
28+
https://api.github.com/repos/"$REPOSITORY_OWNER"/checkstyle/releases/tags/checkstyle-"$TARGET_VERSION" \
2829
| jq ".id")
2930

3031

.github/workflows/release-maven-perform.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,7 @@ jobs:
5757
./.ci/release-create-maven-settings-xml.sh
5858
5959
- name: Run Shell Script
60+
env:
61+
REPOSITORY_OWNER: ${{ github.repository_owner }}
6062
run: |
6163
./.ci/release-maven-perform.sh ${{ inputs.version }}

.github/workflows/release-new-milestone-and-issues-in-other-repos.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,13 @@ jobs:
5252
- name: Close/Create Milestone
5353
env:
5454
GITHUB_TOKEN: ${{ github.token }}
55+
REPOSITORY_OWNER: ${{ github.repository_owner }}
5556
run: |
5657
./.ci/release-close-create-milestone.sh
5758
5859
- name: Creation of issue in other Repositories
5960
env:
6061
GITHUB_TOKEN: ${{ secrets.PAT }}
62+
REPOSITORY_OWNER: ${{ github.repository_owner }}
6163
run: |
6264
./.ci/release-create-issues-in-other-repos.sh ${{ inputs.version }}

.github/workflows/release-publish-releasenotes-twitter.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,6 @@ jobs:
4747
TWITTER_CONSUMER_SECRET: ${{ secrets.TWITTER_CONSUMER_SECRET }}
4848
TWITTER_ACCESS_TOKEN: ${{ secrets.TWITTER_ACCESS_TOKEN }}
4949
TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}
50+
REPOSITORY_OWNER: ${{ github.repository_owner }}
5051
run: |
5152
./.ci/release-publish-releasenotes-twitter.sh ${{ inputs.version }}

.github/workflows/release-update-github-io.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
- name: Checkout the latest code
3333
uses: actions/checkout@v3
3434
with:
35-
repository: checkstyle/checkstyle
35+
repository: ${{ github.repository_owner }}/checkstyle
3636
fetch-depth: 0
3737

3838
- name: Setup local maven cache
@@ -48,7 +48,7 @@ jobs:
4848
- name: Checkout checkstyle.github.io repo
4949
uses: actions/checkout@v3
5050
with:
51-
repository: checkstyle/checkstyle.github.io
51+
repository: ${{ github.repository_owner }}/checkstyle.github.io
5252
token: ${{ secrets.PAT }}
5353
path: .ci-temp/checkstyle.github.io/
5454

.github/workflows/release-update-github-page.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,6 @@ jobs:
4343
- name: Run Shell Script
4444
env:
4545
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
REPOSITORY_OWNER: ${{ github.repository_owner }}
4647
run: |
4748
./.ci/release-update-github-page.sh ${{ inputs.version }}

.github/workflows/release-upload-all-jar.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,6 @@ jobs:
4747
- name: Run GitHub Update Script
4848
env:
4949
GITHUB_TOKEN: ${{ github.token }}
50+
REPOSITORY_OWNER: ${{ github.repository_owner }}
5051
run: |
5152
./.ci/release-upload-all-jar.sh ${{ inputs.version }}

0 commit comments

Comments
 (0)