@@ -13,164 +13,111 @@ on:
1313 tags :
1414 - ' v*' # "v1.2.3"
1515
16+ workflow_dispatch :
17+
1618name : Upload Release Asset
1719
1820jobs :
19- build-amd64 :
20- name : Linux AMD64 release asset
21- runs-on : ubuntu-latest
22- steps :
23- - name : Checkout code
24- uses : actions/checkout@v4
25- - name : Build project
26- id : make_dist
27- run : |
28- make dist-amd64
29- cd dist
30- ARCHIVE=$(echo nimbus-eth1_linux_amd64_*.tar.gz)
31- echo "archive=${ARCHIVE}" >> $GITHUB_OUTPUT
32- echo "archive_dir=${ARCHIVE%.tar.gz}" >> $GITHUB_OUTPUT
33- tar -xzf ${ARCHIVE} ${ARCHIVE%.tar.gz}/build/nimbus_execution_client.sha512sum
34- - name : Upload archive artefact
35- uses : actions/upload-artifact@v4
36- with :
37- name : linux_amd64_archive
38- path : ./dist/${{ steps.make_dist.outputs.archive }}
39- retention-days : 2
40- - name : Upload checksum artefact
41- uses : actions/upload-artifact@v4
42- with :
43- name : linux_amd64_checksum
44- path : ./dist/${{ steps.make_dist.outputs.archive_dir }}/build/nimbus_execution_client.sha512sum
45- retention-days : 2
46- - name : Login to Docker Hub
47- uses : docker/login-action@v1
48- with :
49- username : ${{ secrets.DOCKERHUB_USERNAME }}
50- password : ${{ secrets.DOCKERHUB_TOKEN }}
51- - name : Build and push a Docker image for end users
52- run : |
53- cd dist
54- tar -xzf ${{ steps.make_dist.outputs.archive }}
55- mv ${{ steps.make_dist.outputs.archive_dir }} ../docker/dist/binaries/nimbus-eth1
56- cd ../docker/dist/binaries
57- REFNAME="${{ github.ref }}"
58- TAG="${REFNAME#refs/tags/}"
59- DOCKER_BUILDKIT=1 docker build -f Dockerfile.amd64 -t statusim/nimbus-eth1:amd64-${TAG} -t statusim/nimbus-eth1:amd64-latest .
60- docker push statusim/nimbus-eth1:amd64-${TAG}
61- docker push statusim/nimbus-eth1:amd64-latest
62- build-arm64 :
63- name : Linux ARM64 release asset
21+ matrix_config :
22+ uses : ./.github/workflows/matrix_config.yml
23+
24+ build :
25+ needs : matrix_config
26+
27+ strategy :
28+ fail-fast : false
29+ matrix : ${{ fromJSON(needs.matrix_config.outputs.matrix) }}
30+
31+ defaults :
32+ run :
33+ shell : bash
34+
35+ name : ' ${{ matrix.os }}-${{ matrix.cpu }}'
6436 runs-on : ubuntu-latest
37+
6538 steps :
6639 - name : Install packages
40+ if : matrix.os == 'linux' && matrix.cpu == 'arm64'
6741 env :
6842 DEBIAN_FRONTEND : " noninteractive"
6943 TZ : " Etc/UTC"
7044 run : |
7145 sudo apt-get -qq update
7246 sudo apt-get -qq -y install binfmt-support qemu-user-static
47+
7348 - name : Checkout code
7449 uses : actions/checkout@v4
50+ with :
51+ ref : ${{ github.ref }}
52+
53+ - name : Extract branch name
54+ id : extract_branch
55+ run : echo "branch_name=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT
56+
7557 - name : Build project
7658 id : make_dist
7759 run : |
78- make dist-arm64
60+ make dist-${{ matrix.os }}-${{ matrix.cpu }}
7961 cd dist
80- ARCHIVE=$(echo nimbus-eth1_linux_arm64v8_*.tar.gz)
81- echo "archive=${ARCHIVE}" >> $GITHUB_OUTPUT
82- echo "archive_dir=${ARCHIVE%.tar.gz}" >> $GITHUB_OUTPUT
83- tar -xzf ${ARCHIVE} ${ARCHIVE%.tar.gz}/build/nimbus_execution_client.sha512sum
62+ ARCHIVE=$(echo *.tar.gz)
63+ tar -xzf ${ARCHIVE}
64+ NEW_ARCHIVE_DIR="nimbus-eth1-${{ matrix.os }}-${{ matrix.cpu }}-${{ steps.extract_branch.outputs.branch_name }}-$(git rev-parse --short=8 HEAD)"
65+ mv ${ARCHIVE%.tar.gz} ${NEW_ARCHIVE_DIR}
66+ tar -czf ${NEW_ARCHIVE_DIR}.tar.gz ${NEW_ARCHIVE_DIR}
67+ cp ${NEW_ARCHIVE_DIR}.tar.gz nimbus-eth1-${{ matrix.os }}-${{ matrix.cpu }}.tar.gz
68+ echo "archive=${NEW_ARCHIVE_DIR}.tar.gz" >> $GITHUB_OUTPUT
69+ echo "archive_dir=${NEW_ARCHIVE_DIR}" >> $GITHUB_OUTPUT
70+
8471 - name : Upload archive artefact
8572 uses : actions/upload-artifact@v4
8673 with :
87- name : linux_arm64_archive
88- path : ./dist/${{ steps.make_dist.outputs.archive }}
74+ name : ${{ matrix.os }}-${{ matrix.cpu }}-archive
75+ path : |
76+ ./dist/${{ steps.make_dist.outputs.archive }}
77+ ./dist/nimbus-eth1-${{ matrix.os }}-${{ matrix.cpu }}.tar.gz
8978 retention-days : 2
79+
9080 - name : Upload checksum artefact
9181 uses : actions/upload-artifact@v4
9282 with :
93- name : linux_arm64_checksum
83+ name : ${{ matrix.os }}-${{ matrix.cpu }}-checksum
9484 path : ./dist/${{ steps.make_dist.outputs.archive_dir }}/build/nimbus_execution_client.sha512sum
9585 retention-days : 2
86+
9687 - name : Login to Docker Hub
88+ # This step runs only if the tag starts with 'v'
89+ if : matrix.os == 'linux' && startsWith(github.ref, 'refs/tags/v')
9790 uses : docker/login-action@v1
9891 with :
9992 username : ${{ secrets.DOCKERHUB_USERNAME }}
10093 password : ${{ secrets.DOCKERHUB_TOKEN }}
94+
10195 - name : Build and push a Docker image for end users
96+ # This step runs only if the tag starts with 'v'
97+ if : matrix.os == 'linux' && startsWith(github.ref, 'refs/tags/v')
10298 run : |
10399 cd dist
104100 tar -xzf ${{ steps.make_dist.outputs.archive }}
105101 mv ${{ steps.make_dist.outputs.archive_dir }} ../docker/dist/binaries/nimbus-eth1
106102 cd ../docker/dist/binaries
107103 REFNAME="${{ github.ref }}"
108104 TAG="${REFNAME#refs/tags/}"
109- cp -a /usr/bin/qemu-aarch64-static .
110- DOCKER_BUILDKIT=1 docker build -f Dockerfile.arm64 -t statusim/nimbus-eth1:arm64-${TAG} -t statusim/nimbus-eth1:arm64-latest .
111- docker push statusim/nimbus-eth1:arm64-${TAG}
112- docker push statusim/nimbus-eth1:arm64-latest
113- build-win64 :
114- name : Windows AMD64 release asset
115- runs-on : ubuntu-latest
116- steps :
117- - name : Checkout code
118- uses : actions/checkout@v4
119- - name : Build project
120- id : make_dist
121- run : |
122- make dist-win64
123- cd dist
124- ARCHIVE=$(echo nimbus-eth1_windows_amd64_*.tar.gz)
125- echo "archive=${ARCHIVE}" >> $GITHUB_OUTPUT
126- echo "archive_dir=${ARCHIVE%.tar.gz}" >> $GITHUB_OUTPUT
127- tar -xzf ${ARCHIVE} ${ARCHIVE%.tar.gz}/build/nimbus_execution_client.sha512sum
128- - name : Upload archive artefact
129- uses : actions/upload-artifact@v4
130- with :
131- name : windows_amd64_archive
132- path : ./dist/${{ steps.make_dist.outputs.archive }}
133- retention-days : 2
134- - name : Upload checksum artefact
135- uses : actions/upload-artifact@v4
136- with :
137- name : windows_amd64_checksum
138- path : ./dist/${{ steps.make_dist.outputs.archive_dir }}/build/nimbus_execution_client.sha512sum
139- retention-days : 2
140- build-macos-arm64 :
141- name : macos ARM64 release asset
142- runs-on : ubuntu-latest
143- steps :
144- - name : Checkout code
145- uses : actions/checkout@v4
146- - name : Build project
147- id : make_dist
148- run : |
149- make dist-macos-arm64
150- cd dist
151- ARCHIVE=$(echo nimbus-eth1_macOS_arm64_*.tar.gz)
152- echo "archive=${ARCHIVE}" >> $GITHUB_OUTPUT
153- echo "archive_dir=${ARCHIVE%.tar.gz}" >> $GITHUB_OUTPUT
154- tar -xzf ${ARCHIVE} ${ARCHIVE%.tar.gz}/build/nimbus_execution_client.sha512sum
155- - name : Upload archive artefact
156- uses : actions/upload-artifact@v4
157- with :
158- name : macOS_arm64_archive
159- path : ./dist/${{ steps.make_dist.outputs.archive }}
160- retention-days : 2
161- - name : Upload checksum artefact
162- uses : actions/upload-artifact@v4
163- with :
164- name : macOS_arm64_checksum
165- path : ./dist/${{ steps.make_dist.outputs.archive_dir }}/build/nimbus_execution_client.sha512sum
166- retention-days : 2
105+ DOCKER_BUILDKIT=1 docker build -f Dockerfile.${{ matrix.os }}-${{ matrix.cpu }} -t statusim/nimbus-eth1:${{ matrix.os }}-${{ matrix.cpu }}-${TAG} -t statusim/nimbus-eth1:${{ matrix.os }}-${{ matrix.cpu }}-latest .
106+ docker push statusim/nimbus-eth1:${{ matrix.os }}-${{ matrix.cpu }}-${TAG}
107+ docker push statusim/nimbus-eth1:${{ matrix.os }}-${{ matrix.cpu }}-latest
108+
167109 prepare-release :
168110 name : Prepare release draft
169- needs : [ build-amd64, build-arm64, build-win64, build-macos-arm64]
111+ needs : build
170112 runs-on : ubuntu-latest
171113 steps :
172114 - name : Download artefacts
173115 uses : actions/download-artifact@v4
116+
117+ - name : Extract branch name
118+ id : extract_branch
119+ run : echo "branch_name=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT
120+
174121 - name : Create release notes
175122 run : |
176123 cat > release_notes.md <<EOF
@@ -181,60 +128,62 @@ jobs:
181128 \`\`\`text
182129 EOF
183130 echo '# Linux AMD64' >> release_notes.md
184- cat linux_amd64_checksum /* >> release_notes.md
131+ cat linux-amd64-checksum /* >> release_notes.md
185132 echo '# Linux ARM64' >> release_notes.md
186- cat linux_arm64_checksum /* >> release_notes.md
133+ cat linux-arm64-checksum /* >> release_notes.md
187134 echo '# Windows AMD64' >> release_notes.md
188- cat windows_amd64_checksum /* >> release_notes.md
135+ cat windows-amd64-checksum /* >> release_notes.md
189136 echo '# macos ARM64' >> release_notes.md
190- cat macOS_arm64_checksum /* >> release_notes.md
137+ cat macos-arm64-checksum /* >> release_notes.md
191138 echo '```' >> release_notes.md
139+
192140 - name : Create release
193141 id : create_release
194- uses : softprops/action-gh-release@v1
142+ uses : softprops/action-gh-release@v2
195143 env :
196144 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
197145 with :
198146 draft : true
199147 prerelease : false
148+ name : ' Release build ("${{ steps.extract_branch.outputs.branch_name }}" branch)'
200149 body_path : release_notes.md
201150 files : |
202- linux_amd64_archive/*
203- linux_arm64_archive/*
204- windows_amd64_archive/*
205- macOS_arm64_archive/*
151+ linux-amd64-archive/*
152+ linux-arm64-archive/*
153+ windows-amd64-archive/*
154+ macos-arm64-archive/*
155+
206156 - name : Delete artefacts
207- uses : geekyeggo/delete-artifact@v1
157+ uses : geekyeggo/delete-artifact@v5
208158 with :
209159 failOnError : false
210160 name : |
211- linux_amd64_archive
212- linux_amd64_checksum
213- linux_arm64_archive
214- linux_arm64_checksum
215- windows_amd64_archive
216- windows_amd64_checksum
217- macOS_arm64_archive
218- macOS_arm64_checksum
219-
220- - name : Login to Docker Hub
221- uses : docker/login-action@v1
222- with :
223- username : ${{ secrets.DOCKERHUB_USERNAME }}
224- password : ${{ secrets.DOCKERHUB_TOKEN }}
225-
226- - name : Build multi-arch Docker image
227- run : |
228- REFNAME="${{ github.ref }}"
229- TAG="${REFNAME#refs/tags/}"
230- docker manifest create \
231- statusim/nimbus-eth1:multiarch-${TAG} \
232- --amend statusim/nimbus-eth1:amd64-${TAG} \
233- --amend statusim/nimbus-eth1:arm64-${TAG}
234- docker manifest push statusim/nimbus-eth1:multiarch-${TAG}
235- docker manifest create \
236- statusim/nimbus-eth1:multiarch-latest \
237- --amend statusim/nimbus-eth1:amd64-latest \
238- --amend statusim/nimbus-eth1:arm64-latest
239- docker manifest push statusim/nimbus-eth1:multiarch-latest
161+ linux-amd64-archive
162+ linux-amd64-checksum
163+ linux-arm64-archive
164+ linux-arm64-checksum
165+ windows-amd64-archive
166+ windows-amd64-checksum
167+ macos-arm64-archive
168+ macos-arm64-checksum
240169
170+ # - name: Login to Docker Hub
171+ # uses: docker/login-action@v1
172+ # with:
173+ # username: ${{ secrets.DOCKERHUB_USERNAME }}
174+ # password: ${{ secrets.DOCKERHUB_TOKEN }}
175+ #
176+ # - name: Build multi-arch Docker image
177+ # run: |
178+ # REFNAME="${{ github.ref }}"
179+ # TAG="${REFNAME#refs/tags/}"
180+ # docker manifest create \
181+ # statusim/nimbus-eth1:multiarch-${TAG} \
182+ # --amend statusim/nimbus-eth1:amd64-${TAG} \
183+ # --amend statusim/nimbus-eth1:arm64-${TAG}
184+ # docker manifest push statusim/nimbus-eth1:multiarch-${TAG}
185+ # docker manifest create \
186+ # statusim/nimbus-eth1:multiarch-latest \
187+ # --amend statusim/nimbus-eth1:amd64-latest \
188+ # --amend statusim/nimbus-eth1:arm64-latest
189+ # docker manifest push statusim/nimbus-eth1:multiarch-latest
0 commit comments