@@ -2,8 +2,8 @@ name: Build, Package and Release
22
33on :
44 workflow_run :
5- workflows : ["Rust Build & Test"]
6- types : [completed]
5+ workflows : [ "Rust Build & Test" ]
6+ types : [ completed ]
77
88jobs :
99 build :
@@ -28,18 +28,22 @@ jobs:
2828 steps :
2929 - name : Checkout repository
3030 uses : actions/checkout@v4
31-
31+
32+ - name : Extract version
33+ id : extract_version
34+ run : |
35+ VERSION=$(grep '^version' Cargo.toml | head -n1 | cut -d '"' -f2)
36+ echo "VERSION=$VERSION" >> $GITHUB_ENV
37+
3238 - name : Install Rust target
3339 run : rustup target add ${{ matrix.target }}
34-
40+
3541 - name : Build binary
3642 run : cargo build --release --target ${{ matrix.target }}
37-
43+
3844 - name : Package binary
3945 shell : bash
4046 run : |
41- VERSION=$(grep '^version' $GITHUB_WORKSPACE/Cargo.toml | head -n1 | cut -d '"' -f2)
42-
4347 mkdir -p release_artifacts/${{ matrix.target }}
4448 cd target/${{ matrix.target }}/release
4549 mkdir -p rfortune-${{ matrix.target }}
5357 tar -czvf rfortune-${VERSION}-${{ matrix.target }}.tar.gz rfortune-${{ matrix.target }}
5458 cp rfortune-${VERSION}-${{ matrix.target }}.tar.gz $GITHUB_WORKSPACE/release_artifacts/${{ matrix.target }}/
5559 fi
56-
60+
5761 - name : Generate SHA256 checksum
5862 shell : bash
5963 run : |
8286 env :
8387 GPG_PRIVATE_KEY : ${{ secrets.GPG_PRIVATE_KEY }}
8488 GPG_PASSPHRASE : ${{ secrets.GPG_PASSPHRASE }}
85-
89+
8690 - name : Upload artifact by platform
8791 uses : actions/upload-artifact@v4
8892 with :
@@ -96,20 +100,20 @@ jobs:
96100 steps :
97101 - name : Checkout repository
98102 uses : actions/checkout@v4
99-
103+
100104 - name : Download all build artifacts
101105 uses : actions/download-artifact@v4
102106 with :
103107 pattern : release_artifacts-*
104108 path : temp_download
105109 merge-multiple : true
106-
110+
107111 - name : Combine into single folder
108112 shell : bash
109113 run : |
110114 mkdir -p release_artifacts
111115 find temp_download -type f -exec cp {} release_artifacts/ \;
112-
116+
113117 - name : Upload consolidated artifacts
114118 uses : actions/upload-artifact@v4
115119 with :
@@ -123,19 +127,19 @@ jobs:
123127 steps :
124128 - name : Checkout repository
125129 uses : actions/checkout@v4
126-
130+
127131 - name : Download consolidated artifacts
128132 uses : actions/download-artifact@v4
129133 with :
130134 name : release_artifacts
131135 path : release_artifacts
132-
136+
133137 - name : Extract version from Cargo.toml
134138 id : extract_version
135139 run : |
136140 VERSION=$(grep '^version' Cargo.toml | head -n1 | cut -d '"' -f2)
137141 echo "version=$VERSION" >> $GITHUB_OUTPUT
138-
142+
139143 - name : Create GitHub Release
140144 uses : softprops/action-gh-release@v1
141145 with :
0 commit comments