Skip to content

Commit

Permalink
Fix release approval handling (#5097)
Browse files Browse the repository at this point in the history
  • Loading branch information
rubo authored and kamilchodola committed Jan 5, 2023
1 parent 07b9f06 commit 9e8b3da
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 11 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/release-nethermind.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ jobs:
update-homebrew:
name: Update Homebrew formula
runs-on: ubuntu-latest
needs: approval
needs: [approval, build]
if: needs.build.outputs.PRERELEASE == 'false'
steps:
- name: Restore packages from cache
Expand Down Expand Up @@ -145,7 +145,7 @@ jobs:
publish-github:
name: Publish to GitHub
runs-on: ubuntu-latest
needs: approval
needs: [approval, build]
steps:
- name: Restore packages from cache
uses: actions/cache@v3
Expand All @@ -166,7 +166,7 @@ jobs:
publish-downloads:
name: Publish to Downloads page
runs-on: ubuntu-latest
needs: approval
needs: [approval, build]
if: needs.build.outputs.PRERELEASE == 'false'
steps:
- name: Restore packages from cache
Expand All @@ -191,7 +191,7 @@ jobs:
publish-dockers:
name: Publish to Docker Hub
runs-on: ubuntu-latest
needs: approval
needs: [approval, build]
env:
DOCKER_IMAGE: nethermind/nethermind
steps:
Expand Down Expand Up @@ -225,7 +225,7 @@ jobs:
publish-ppa:
name: Publish to PPA
runs-on: ubuntu-latest
needs: approval
needs: [approval, build]
if: needs.build.outputs.PRERELEASE == 'false'
env:
PPA_GPG_KEYID: ${{ secrets.PPA_GPG_KEYID }}
Expand Down
4 changes: 2 additions & 2 deletions scripts/deployment/publish-downloads.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ do

curl https://downloads.nethermind.io/files?apikey=$DOWNLOADS_PAGE \
-X POST \
--fail-with-body \
-# \
-F "files=@$PWD/$FILE_NAME" \
-F "files=@$PWD/$FILE_NAME.asc" \
--fail
-F "files=@$PWD/$FILE_NAME.asc"
done

echo "Publishing completed"
25 changes: 21 additions & 4 deletions scripts/deployment/publish-github.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,27 @@ BODY=$(printf \

echo "Drafting release $GIT_TAG"

RELEASE_ID=$(curl https://api.github.com/repos/$GITHUB_REPOSITORY/releases \
-X POST \
RELEASE_ID=$(curl https://api.github.com/repos/$GITHUB_REPOSITORY/releases/tags/$GIT_TAG \
-X GET \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-d "$BODY" | jq -r '.id')
-H "Authorization: Bearer $GITHUB_TOKEN" | jq -r '.id')

if [ "$RELEASE_ID" == "null" ]
then
RELEASE_ID=$(curl https://api.github.com/repos/$GITHUB_REPOSITORY/releases \
-X POST \
--fail-with-body \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-d "$BODY" | jq -r '.id')
else
curl https://api.github.com/repos/$GITHUB_REPOSITORY/releases/$RELEASE_ID \
-X PATCH \
--fail-with-body \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-d "$BODY"
fi

cd $PACKAGE_PATH

Expand All @@ -30,6 +46,7 @@ do

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

0 comments on commit 9e8b3da

Please sign in to comment.