Skip to content

Commit

Permalink
Revise release workflow (NethermindEth#6634)
Browse files Browse the repository at this point in the history
  • Loading branch information
rubo authored and kamilchodola committed Feb 16, 2024
1 parent d128f58 commit 73aaee0
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 37 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/publish-nuget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ jobs:
ref: ${{ github.event.release.tag_name }}
- name: Set up .NET
uses: actions/setup-dotnet@v4
- name: Wait to ensure assets are uploaded
run: sleep 5m
- name: Download Nethermind reference assemblies
run: |
json=$(curl -s ${{ github.event.release.assets_url }})
Expand Down
14 changes: 3 additions & 11 deletions .github/workflows/publish-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,10 @@ on:
types: [published]

jobs:
wait:
name: Wait for assets
runs-on: ubuntu-latest
if: ${{ !github.event.release.prerelease }}
steps:
- name: Wait to ensure assets are uploaded
run: sleep 5m

publish-ppa:
name: Publish on PPA
runs-on: ubuntu-latest
needs: wait
if: ${{ !github.event.release.prerelease }}
steps:
- name: Check out Nethermind repository
uses: actions/checkout@v4
Expand Down Expand Up @@ -90,7 +82,7 @@ jobs:
publish-winget:
name: Publish on Windows Package Manager
runs-on: windows-latest
needs: wait
if: ${{ !github.event.release.prerelease }}
steps:
- name: Submit package
run: |
Expand All @@ -102,7 +94,7 @@ jobs:
publish-homebrew:
name: Publish on Homebrew
runs-on: ubuntu-latest
needs: wait
if: ${{ !github.event.release.prerelease }}
env:
FORMULA: nethermind.rb
steps:
Expand Down
3 changes: 1 addition & 2 deletions scripts/deployment/build-cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ cd $GITHUB_WORKSPACE/src/Nethermind/Nethermind.Cli

echo "Building Nethermind CLI"

for rid in "linux-x64" "linux-arm64" "win-x64" "osx-x64" "osx-arm64"
do
for rid in "linux-x64" "linux-arm64" "win-x64" "osx-x64" "osx-arm64"; do
echo " Publishing for $rid"

dotnet publish -c release -r $rid -o $output_path/$rid --sc true \
Expand Down
3 changes: 1 addition & 2 deletions scripts/deployment/build-runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ cd $GITHUB_WORKSPACE/src/Nethermind/Nethermind.Runner

echo "Building Nethermind"

for rid in "linux-x64" "linux-arm64" "win-x64" "osx-x64" "osx-arm64"
do
for rid in "linux-x64" "linux-arm64" "win-x64" "osx-x64" "osx-arm64"; do
echo " Publishing for $rid"

dotnet publish -c $build_config -r $rid -o $output_path/$rid --sc true \
Expand Down
3 changes: 1 addition & 2 deletions scripts/deployment/publish-downloads.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ echo "Publishing packages to Downloads page"

cd $GITHUB_WORKSPACE/$PACKAGE_DIR

for rid in "linux-x64" "linux-arm64" "windows-x64" "macos-x64" "macos-arm64"
do
for rid in "linux-x64" "linux-arm64" "windows-x64" "macos-x64" "macos-arm64"; do
file_name=$(basename *$rid*)

echo "Signing $file_name"
Expand Down
40 changes: 22 additions & 18 deletions scripts/deployment/publish-github.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ release_id=$(curl https://api.github.com/repos/$GITHUB_REPOSITORY/releases \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_TOKEN" | jq -r '.[] | select(.tag_name == "'$GIT_TAG'") | .id')

if [ "$release_id" == "" ]
then
should_publish=true

if [ "$release_id" == "" ]; then
echo "Drafting release $GIT_TAG"

body=$(printf \
Expand All @@ -25,27 +26,13 @@ then
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-d "$body" | jq -r '.id')
else
echo "Publishing release $GIT_TAG"

make_latest=$([ $PRERELEASE = 'true' ] && echo "false" || echo "true")

body=$(printf \
'{"target_commitish": "%s", "name": "v%s", "draft": false, "make_latest": "%s", "prerelease": %s}' \
$GITHUB_SHA $GIT_TAG $make_latest $PRERELEASE)

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"
should_publish=false
fi

cd $GITHUB_WORKSPACE/$PACKAGE_DIR

for rid in "linux-x64" "linux-arm64" "windows-x64" "macos-x64" "macos-arm64" "ref-assemblies"
do
for rid in "linux-x64" "linux-arm64" "windows-x64" "macos-x64" "macos-arm64" "ref-assemblies"; do
file_name=$(basename *$rid*)

echo "Uploading $file_name"
Expand All @@ -59,4 +46,21 @@ do
--data-binary @"$file_name"
done

if [ "$should_publish" == "true" ]; then
echo "Publishing release $GIT_TAG"

make_latest=$([ $PRERELEASE = 'true' ] && echo "false" || echo "true")

body=$(printf \
'{"target_commitish": "%s", "name": "v%s", "draft": false, "make_latest": "%s", "prerelease": %s}' \
$GITHUB_SHA $GIT_TAG $make_latest $PRERELEASE)

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

echo "Publishing completed"

0 comments on commit 73aaee0

Please sign in to comment.