Skip to content

Commit 056f53d

Browse files
committed
parallelize workflows
1 parent e214226 commit 056f53d

File tree

1 file changed

+122
-66
lines changed

1 file changed

+122
-66
lines changed

.github/workflows/release.yml

Lines changed: 122 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -38,23 +38,26 @@ env:
3838
CORE_VERSION: ${{ github.event.inputs.core }}
3939

4040
jobs:
41-
pre-release:
42-
name: Create pre-release artifacts
41+
set-versions:
42+
name: Set versions and check regex
4343
runs-on: ubuntu-latest
44-
defaults:
45-
run:
46-
shell: bash
47-
44+
outputs:
45+
bind: ${{ env.BIND_VERSION }}
46+
ipfs: ${{ env.IPFS_VERSION }}
47+
dappmanager: ${{ env.DAPPMANAGER_VERSION }}
48+
wifi: ${{ env.WIFI_VERSION }}
49+
wireguard: ${{ env.WIREGUARD_VERSION }}
50+
https: ${{ env.HTTPS_VERSION }}
51+
vpn: ${{ env.VPN_VERSION }}
52+
core: ${{ env.CORE_VERSION }}
4853
steps:
4954
- name: Check versions regex
5055
run: |
5156
[[ $BIND_VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] && [[ $IPFS_VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] && [[ $DAPPMANAGER_VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] && \
5257
[[ $WIFI_VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] && [[ $WIREGUARD_VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] && [[ $HTTPS_VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] && \
5358
[[ $VPN_VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] && [[ $CORE_VERSION =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]] || { echo "versions introduced in wrong format"; exit 1; }
54-
5559
- name: Checkout
5660
uses: actions/checkout@v4
57-
5861
- name: Set new versions
5962
run: |
6063
sed -i -e "/BIND_VERSION/s/[0-9]*\.[0-9]*\.[0-9]*/"${BIND_VERSION}"/" .dappnode_profile
@@ -65,107 +68,161 @@ jobs:
6568
sed -i -e "/WIREGUARD_VERSION/s/[0-9]*\.[0-9]*\.[0-9]*/"${WIREGUARD_VERSION}"/" .dappnode_profile
6669
sed -i -e "/HTTPS_VERSION/s/[0-9]*\.[0-9]*\.[0-9]*/"${HTTPS_VERSION}"/" .dappnode_profile
6770
cat .dappnode_profile
71+
- name: Create dappnode_profile.sh
72+
run: cp .dappnode_profile dappnode_profile.sh
73+
- name: Upload dappnode_profile.sh
74+
uses: actions/upload-artifact@v4
75+
with:
76+
name: dappnode_profile
77+
path: dappnode_profile.sh
6878

79+
build-debian-attended:
80+
name: Build Debian attended ISO
81+
runs-on: ubuntu-latest
82+
needs: set-versions
83+
steps:
84+
- uses: actions/checkout@v4
85+
- name: Download dappnode_profile
86+
uses: actions/download-artifact@v4
87+
with:
88+
name: dappnode_profile
6989
- name: Build Debian attended
7090
run: |
7191
export BASE_OS=debian
7292
export UNATTENDED=false
7393
docker compose up --build
74-
75-
- name: Check Debian ISO attended
76-
run: |
77-
ls -lrt images/Dappnode-debian-*.iso
78-
7994
- name: Set Debian Dappnode attended ISO name
8095
run: |
8196
file=$(ls images/Dappnode-debian-*.iso)
82-
filename=$(basename "$file") # Extract only the file name (without path)
83-
core_filename="Dappnode-${CORE_VERSION}-debian-${filename#Dappnode-debian-}" # Modify the filename using CORE_VERSION
84-
attended_filename="${core_filename/%.iso/-attended.iso}" # Replace .iso with -attended.iso
97+
filename=$(basename "$file")
98+
core_filename="Dappnode-${{ needs.set-versions.outputs.core }}-debian-${filename#Dappnode-debian-}"
99+
attended_filename="${core_filename/%.iso/-attended.iso}"
85100
sudo cp "$file" "images/$attended_filename"
101+
- name: Upload Debian attended ISO
102+
uses: actions/upload-artifact@v4
103+
with:
104+
name: debian-attended-iso
105+
path: images/*-attended.iso
106+
- name: Get SHA-256 Debian attended
107+
run: |
108+
file=$(find images/ -type f -name '*-attended.iso')
109+
shasum -a 256 $file > SHASUM_DEBIAN_ATTENDED.txt
110+
- name: Upload Debian attended SHA256
111+
uses: actions/upload-artifact@v4
112+
with:
113+
name: debian-attended-sha
114+
path: SHASUM_DEBIAN_ATTENDED.txt
86115

116+
build-debian-unattended:
117+
name: Build Debian unattended ISO
118+
runs-on: ubuntu-latest
119+
needs: set-versions
120+
steps:
121+
- uses: actions/checkout@v4
122+
- name: Download dappnode_profile
123+
uses: actions/download-artifact@v4
124+
with:
125+
name: dappnode_profile
87126
- name: Build Debian unattended
88127
run: |
89128
export BASE_OS=debian
90129
export UNATTENDED=true
91130
docker compose build
92131
docker compose up
93-
94-
- name: Check Debian ISO unattended
95-
run: |
96-
ls -lrt images/Dappnode-debian-*.iso
97-
98132
- name: Set Debian Dappnode unattended ISO name
99133
run: |
100134
file=$(ls images/Dappnode-debian-*.iso)
101-
filename=$(basename "$file") # Extract only the file name (without path)
102-
core_filename="Dappnode-${CORE_VERSION}-debian-${filename#Dappnode-debian-}" # Modify the filename using CORE_VERSION
103-
unattended_filename="${core_filename/%.iso/-unattended.iso}" # Replace .iso with -unattended.iso
135+
filename=$(basename "$file")
136+
core_filename="Dappnode-${{ needs.set-versions.outputs.core }}-debian-${filename#Dappnode-debian-}"
137+
unattended_filename="${core_filename/%.iso/-unattended.iso}"
104138
sudo cp "$file" "images/$unattended_filename"
139+
- name: Upload Debian unattended ISO
140+
uses: actions/upload-artifact@v4
141+
with:
142+
name: debian-unattended-iso
143+
path: images/*-unattended.iso
144+
- name: Get SHA-256 Debian unattended
145+
run: |
146+
file=$(find images/ -type f -name '*-unattended.iso')
147+
shasum -a 256 $file > SHASUM_DEBIAN_UNATTENDED.txt
148+
- name: Upload Debian unattended SHA256
149+
uses: actions/upload-artifact@v4
150+
with:
151+
name: debian-unattended-sha
152+
path: SHASUM_DEBIAN_UNATTENDED.txt
105153

154+
build-ubuntu-unattended:
155+
name: Build Ubuntu unattended ISO
156+
runs-on: ubuntu-latest
157+
needs: set-versions
158+
steps:
159+
- uses: actions/checkout@v4
160+
- name: Download dappnode_profile
161+
uses: actions/download-artifact@v4
162+
with:
163+
name: dappnode_profile
106164
- name: Build Ubuntu unattended
107165
run: |
108166
export BASE_OS=ubuntu
109167
export UNATTENDED=true
110168
docker compose up --build
111-
112-
- name: Check Ubuntu ISO unattended
113-
run: |
114-
ls -lrt images/Dappnode-ubuntu-*.iso
115-
116169
- name: Set Ubuntu Dappnode unattended ISO name
117170
run: |
118171
file=$(ls images/Dappnode-ubuntu-*.iso)
119-
filename=$(basename "$file") # Extract only the file name (without path)
120-
core_filename="Dappnode-${CORE_VERSION}-ubuntu-${filename#Dappnode-ubuntu-}" # Modify the filename using CORE_VERSION
121-
unattended_filename="${core_filename/%.iso/-unattended.iso}" # Replace .iso with -unattended.iso
172+
filename=$(basename "$file")
173+
core_filename="Dappnode-${{ needs.set-versions.outputs.core }}-ubuntu-${filename#Dappnode-ubuntu-}"
174+
unattended_filename="${core_filename/%.iso/-unattended.iso}"
122175
sudo cp "$file" "images/$unattended_filename"
123-
124-
- name: Create dappnode_profile.sh
125-
run: |
126-
cp .dappnode_profile dappnode_profile.sh
127-
128-
# SHASUMs
129-
- name: Get SHA-256 Debian attended
130-
id: shasum-debian-attended
131-
run: |
132-
file=$(find . -type f -name 'Dappnode-debian-*.iso' ! -name '*unattended*')
133-
SHASUM_DEBIAN_ATTENDED=$(shasum -a 256 $file)
134-
echo "::set-output name=SHASUM_DEBIAN_ATTENDED::$SHASUM_DEBIAN_ATTENDED"
135-
136-
- name: Get SHA-256 Debian unattended
137-
id: shasum-debian-unattended
138-
run: |
139-
file=$(find . -type f -name 'Dappnode-debian-*unattended.iso')
140-
SHASUM_DEBIAN_UNATTENDED=$(shasum -a 256 $file)
141-
echo "::set-output name=SHASUM_DEBIAN_UNATTENDED::$SHASUM_DEBIAN_UNATTENDED"
142-
143176
- name: Get SHA-256 Ubuntu unattended
144-
id: shasum-ubuntu-unattended
145177
run: |
146-
file=$(find . -type f -name 'Dappnode-ubuntu-*unattended.iso')
147-
SHASUM_UBUNTU_UNATTENDED=$(shasum -a 256 $file)
148-
echo "$SHASUM_UBUNTU_UNATTENDED" > SHASUM_UBUNTU_UNATTENDED.txt
149-
echo "::set-output name=SHASUM_UBUNTU_UNATTENDED::$SHASUM_UBUNTU_UNATTENDED"
178+
file=$(find images/ -type f -name '*-ubuntu-*-unattended.iso')
179+
shasum -a 256 $file > SHASUM_UBUNTU_UNATTENDED.txt
180+
- name: Upload Ubuntu unattended ISO and SHA256 to SSH
181+
uses: appleboy/scp-action@v0.1.7
182+
with:
183+
host: ${{ secrets.ISO_SSH_HOST }}
184+
username: ${{ secrets.ISO_SSH_USER }}
185+
key: ${{ secrets.ISO_SSH_PRIVATE_KEY }}
186+
port: ${{ secrets.SSH_PORT }}
187+
source: SHASUM_UBUNTU_UNATTENDED.txt,images/*-ubuntu-*-unattended.iso
188+
target: ${{ secrets.ISO_SSH_PATH }}
189+
overwrite: true
150190

191+
release:
192+
name: Combine, release, and upload
193+
runs-on: ubuntu-latest
194+
needs:
195+
- build-debian-attended
196+
- build-debian-unattended
197+
- build-ubuntu-unattended
198+
steps:
199+
- uses: actions/checkout@v4
200+
- name: Download all artifacts
201+
uses: actions/download-artifact@v4
202+
with:
203+
path: ./artifacts
204+
- name: Move ISOs and SHAs
205+
run: |
206+
mkdir -p images
207+
mv artifacts/debian-attended-iso/* images/
208+
mv artifacts/debian-unattended-iso/* images/
209+
mv artifacts/debian-attended-sha/* .
210+
mv artifacts/debian-unattended-sha/* .
211+
mv artifacts/dappnode_profile/* .
151212
- name: Write release content
152213
run: |
153-
echo -en "# Versions\n| Package | Version |\n|---|---|\nbind.dnp.dappnode.eth|${BIND_VERSION}|\n|ipfs.dnp.dappnode.eth|${IPFS_VERSION}|\n|vpn.dnp.dappnode.eth |${VPN_VERSION}|\n|dappmanager.dnp.dappnode.eth|${DAPPMANAGER_VERSION}|\n|wifi.dnp.dappnode.eth|${WIFI_VERSION}|\n|https.dnp.dappnode.eth|${HTTPS_VERSION}|\n|wireguard.dnp.dappnode.eth|${WIREGUARD_VERSION}|\n# Changes\nChanges implemented in release ${CORE_VERSION}\n# Debian Attended version\nInstall and customize DAppNode using the attended ISO: **DAppNode-${CORE_VERSION}-debian-bookworm-amd64.iso**\n\n## ISO SHA-256 Checksum\n\`\`\`\nshasum -a 256 DAppNode-${CORE_VERSION}-debian-bookworm-amd64.iso\n${SHASUM_DEBIAN_ATTENDED}\n\`\`\`\n# Debian Unattended version\nInstall DAppNode easily using the unattended ISO: **DAppNode-${CORE_VERSION}-debian-bookworm-amd64-unattended.iso**\nDo a reboot right after the installation\n:warning: **Warning**: This ISO will install Dappnode automatically, deleting all existing partitions on the disk\n\n## ISO SHA-256 Checksum\n\`\`\`\nshasum -a 256 DAppNode-${CORE_VERSION}-debian-bookworm-amd64-unattended.iso\n${SHASUM_DEBIAN_UNATTENDED}\n\`\`\`\nDo a reboot right after the installation\n:warning: **Warning**: This ISO will install Dappnode automatically, deleting all existing partitions on the disk\n\n## ISO SHA-256 Checksum\n\`\`\`\n\`\`\`\n# DAppNode for Raspberry Pi 4 64bit\n[Instructions](https://github.com/dappnode/DAppNode/wiki/DAppNodeARM-Installation-Guide)\n\ndefault login data:\n - **__user__**: dappnode\n - **__password__**: dappnodepi" > CHANGELOG.md
214+
SHASUM_DEBIAN_ATTENDED=$(cat SHASUM_DEBIAN_ATTENDED.txt)
215+
SHASUM_DEBIAN_UNATTENDED=$(cat SHASUM_DEBIAN_UNATTENDED.txt)
216+
echo -en "# Versions\n| Package | Version |\n|---|---|\nbind.dnp.dappnode.eth|${{ needs.set-versions.outputs.bind }}|\n|ipfs.dnp.dappnode.eth|${{ needs.set-versions.outputs.ipfs }}|\n|vpn.dnp.dappnode.eth |${{ needs.set-versions.outputs.vpn }}|\n|dappmanager.dnp.dappnode.eth|${{ needs.set-versions.outputs.dappmanager }}|\n|wifi.dnp.dappnode.eth|${{ needs.set-versions.outputs.wifi }}|\n|https.dnp.dappnode.eth|${{ needs.set-versions.outputs.https }}|\n|wireguard.dnp.dappnode.eth|${{ needs.set-versions.outputs.wireguard }}|\n# Changes\nChanges implemented in release ${{ needs.set-versions.outputs.core }}\n# Debian Attended version\nInstall and customize DAppNode using the attended ISO: **DAppNode-${{ needs.set-versions.outputs.core }}-debian-bookworm-amd64.iso**\n\n## ISO SHA-256 Checksum\n```\nshasum -a 256 DAppNode-${{ needs.set-versions.outputs.core }}-debian-bookworm-amd64.iso\n$SHASUM_DEBIAN_ATTENDED\n```\n# Debian Unattended version\nInstall DAppNode easily using the unattended ISO: **DAppNode-${{ needs.set-versions.outputs.core }}-debian-bookworm-amd64-unattended.iso**\nDo a reboot right after the installation\n:warning: **Warning**: This ISO will install Dappnode automatically, deleting all existing partitions on the disk\n\n## ISO SHA-256 Checksum\n```\nshasum -a 256 DAppNode-${{ needs.set-versions.outputs.core }}-debian-bookworm-amd64-unattended.iso\n$SHASUM_DEBIAN_UNATTENDED\n```\n# Ubuntu Unattended version\nInstall DAppNode easily using the unattended ISO: **DAppNode-${{ needs.set-versions.outputs.core }}-ubuntu-bookworm-amd64-unattended.iso**\n\n## ISO SHA-256 Checksum\nUploaded directly to SSH server.\n# DAppNode for Raspberry Pi 4 64bit\n[Instructions](https://github.com/dappnode/DAppNode/wiki/DAppNodeARM-Installation-Guide)\n\ndefault login data:\n - **__user__**: dappnode\n - **__password__**: dappnodepi" > CHANGELOG.md
154217
cat CHANGELOG.md
155-
env:
156-
SHASUM_DEBIAN_ATTENDED: ${{ steps.shasum-debian-attended.outputs.SHASUM_DEBIAN_ATTENDED }}
157-
SHASUM_DEBIAN_UNATTENDED: ${{ steps.shasum-debian-unattended.outputs.SHASUM_DEBIAN_UNATTENDED }}
158-
159-
# print images directory
160218
- name: Print images directory
161219
run: |
162220
echo "Images directory content:"
163221
ls -lrt images/
164-
165222
- name: Create pre-release
166223
uses: softprops/action-gh-release@v2
167224
with:
168-
tag_name: ${{ github.event.inputs.core }}
225+
tag_name: ${{ needs.set-versions.outputs.core }}
169226
prerelease: true
170227
files: |
171228
./images/Dappnode-*-debian-*-attended.iso
@@ -177,7 +234,6 @@ jobs:
177234
body_path: CHANGELOG.md
178235
env:
179236
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
180-
181237
- name: Upload Ubuntu unattended to SSH server (and shasum)
182238
uses: appleboy/scp-action@v0.1.7
183239
with:

0 commit comments

Comments
 (0)