Skip to content

Commit 9e8b3da

Browse files
rubokamilchodola
authored andcommitted
Fix release approval handling (#5097)
1 parent 07b9f06 commit 9e8b3da

File tree

3 files changed

+28
-11
lines changed

3 files changed

+28
-11
lines changed

.github/workflows/release-nethermind.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ jobs:
101101
update-homebrew:
102102
name: Update Homebrew formula
103103
runs-on: ubuntu-latest
104-
needs: approval
104+
needs: [approval, build]
105105
if: needs.build.outputs.PRERELEASE == 'false'
106106
steps:
107107
- name: Restore packages from cache
@@ -145,7 +145,7 @@ jobs:
145145
publish-github:
146146
name: Publish to GitHub
147147
runs-on: ubuntu-latest
148-
needs: approval
148+
needs: [approval, build]
149149
steps:
150150
- name: Restore packages from cache
151151
uses: actions/cache@v3
@@ -166,7 +166,7 @@ jobs:
166166
publish-downloads:
167167
name: Publish to Downloads page
168168
runs-on: ubuntu-latest
169-
needs: approval
169+
needs: [approval, build]
170170
if: needs.build.outputs.PRERELEASE == 'false'
171171
steps:
172172
- name: Restore packages from cache
@@ -191,7 +191,7 @@ jobs:
191191
publish-dockers:
192192
name: Publish to Docker Hub
193193
runs-on: ubuntu-latest
194-
needs: approval
194+
needs: [approval, build]
195195
env:
196196
DOCKER_IMAGE: nethermind/nethermind
197197
steps:
@@ -225,7 +225,7 @@ jobs:
225225
publish-ppa:
226226
name: Publish to PPA
227227
runs-on: ubuntu-latest
228-
needs: approval
228+
needs: [approval, build]
229229
if: needs.build.outputs.PRERELEASE == 'false'
230230
env:
231231
PPA_GPG_KEYID: ${{ secrets.PPA_GPG_KEYID }}

scripts/deployment/publish-downloads.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ do
2222

2323
curl https://downloads.nethermind.io/files?apikey=$DOWNLOADS_PAGE \
2424
-X POST \
25+
--fail-with-body \
2526
-# \
2627
-F "files=@$PWD/$FILE_NAME" \
27-
-F "files=@$PWD/$FILE_NAME.asc" \
28-
--fail
28+
-F "files=@$PWD/$FILE_NAME.asc"
2929
done
3030

3131
echo "Publishing completed"

scripts/deployment/publish-github.sh

+21-4
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,27 @@ BODY=$(printf \
1414

1515
echo "Drafting release $GIT_TAG"
1616

17-
RELEASE_ID=$(curl https://api.github.com/repos/$GITHUB_REPOSITORY/releases \
18-
-X POST \
17+
RELEASE_ID=$(curl https://api.github.com/repos/$GITHUB_REPOSITORY/releases/tags/$GIT_TAG \
18+
-X GET \
1919
-H "Accept: application/vnd.github+json" \
20-
-H "Authorization: Bearer $GITHUB_TOKEN" \
21-
-d "$BODY" | jq -r '.id')
20+
-H "Authorization: Bearer $GITHUB_TOKEN" | jq -r '.id')
21+
22+
if [ "$RELEASE_ID" == "null" ]
23+
then
24+
RELEASE_ID=$(curl https://api.github.com/repos/$GITHUB_REPOSITORY/releases \
25+
-X POST \
26+
--fail-with-body \
27+
-H "Accept: application/vnd.github+json" \
28+
-H "Authorization: Bearer $GITHUB_TOKEN" \
29+
-d "$BODY" | jq -r '.id')
30+
else
31+
curl https://api.github.com/repos/$GITHUB_REPOSITORY/releases/$RELEASE_ID \
32+
-X PATCH \
33+
--fail-with-body \
34+
-H "Accept: application/vnd.github+json" \
35+
-H "Authorization: Bearer $GITHUB_TOKEN" \
36+
-d "$BODY"
37+
fi
2238

2339
cd $PACKAGE_PATH
2440

@@ -30,6 +46,7 @@ do
3046

3147
curl https://uploads.github.com/repos/$GITHUB_REPOSITORY/releases/$RELEASE_ID/assets?name=$FILE_NAME \
3248
-X POST \
49+
--fail-with-body \
3350
-H "Accept: application/vnd.github+json" \
3451
-H "Authorization: Bearer $GITHUB_TOKEN" \
3552
-H "Content-Type: application/octet-stream" \

0 commit comments

Comments
 (0)