1- name : Check experiment
1+ name : check-build-assets-and-publish
2+ run-name : Build assets for projects
23
34on :
45 push
78 check :
89 runs-on : ubuntu-latest
910
10- strategy :
11- matrix :
12- project : ["str-utilities"]
11+ strategy : { matrix: { project: [str-utilities] } }
1312
1413 steps :
1514 - uses : actions/checkout@v4
@@ -34,20 +33,22 @@ jobs:
3433
3534 strategy :
3635 matrix :
37- os : [ubuntu-latest, windows-latest]
38- binary : [str-utilities~group ]
36+ os : [ubuntu-latest, windows-latest, macos-latest ]
37+ binary : [str-utilities~wrap ]
3938 include :
4039 - os : windows-latest
4140 platform-name : x86_64-pc-windows
4241 executable-extension : " .exe"
4342 - os : ubuntu-latest
4443 platform-name : x86_64-unknown-linux
44+ - os : macos-latest
45+ platform-name : aarch64-apple-darwin
4546
4647 runs-on : ${{ matrix.os }}
4748
4849 env :
4950 PROFILE : dev
50- OUT : debug
51+ OUT : target/ debug
5152 GH_RELEASE : assets
5253
5354 steps :
@@ -56,24 +57,24 @@ jobs:
5657
5758 - name : Set variables
5859 id : information
60+ shell : bash
5961 run : |
6062 echo "GITHUB_RUN_DATE=$(TZ="Europe/London" date +"%Y-%m-%d %T")" >> "$GITHUB_OUTPUT"
6163 echo "GIT_LAST_COMMIT=$(git log -n 1 --format="%H")" >> "$GITHUB_OUTPUT"
6264
63- IFS='~' read -r binary example <<< '${{ matrix.binary }}'
64- echo "WORKING_DIRECTORY=$binary" >> "$GITHUB_OUTPUT"
65+ IFS='~' read -r project example <<< '${{ matrix.binary }}'
66+ echo "WORKING_DIRECTORY=$project" >> "$GITHUB_OUTPUT"
67+ echo "PROJECT_NAME=$project" >> "$GITHUB_OUTPUT"
6568 if [ -n "$example" ]; then
6669 echo "BUILD_SPECIFIER=--example $example" >> "$GITHUB_OUTPUT"
67- echo "ASSET_PATH=examples/$example" >> "$GITHUB_OUTPUT"
70+ echo "ASSET_PATH=${{ env.OUT }}/ examples/$example${{ matrix.executable-extension }} " >> "$GITHUB_OUTPUT"
6871 echo "ASSET_NAME=$example" >> "$GITHUB_OUTPUT"
6972 else
7073 echo "BUILD_SPECIFIER=" >> "$GITHUB_OUTPUT"
71- echo "ASSET_PATH=$binary " >> "$GITHUB_OUTPUT"
72- echo "ASSET_NAME=$binary " >> "$GITHUB_OUTPUT"
74+ echo "ASSET_PATH=${{ env.OUT }}/$project${{ matrix.executable-extension }} " >> "$GITHUB_OUTPUT"
75+ echo "ASSET_NAME=$project " >> "$GITHUB_OUTPUT"
7376 fi
7477
75- shell : bash
76-
7778 - name : Build binary
7879 working-directory : ${{ steps.information.outputs.WORKING_DIRECTORY }}
7980 run : cargo build ${{ steps.information.outputs.BUILD_SPECIFIER }} --profile ${{ env.PROFILE }}
@@ -83,10 +84,11 @@ jobs:
8384
8485 - name : Publish binary
8586 working-directory : ${{ steps.information.outputs.WORKING_DIRECTORY }}
86- run : |
87- FROM="./target/${{ env.OUT }}/${{ steps.information.outputs.ASSET_PATH }}${{ matrix.executable-extension }}"
88- TO="${{ steps.information.outputs.ASSET_NAME }}-${{ matrix.platform-name }}${{ matrix.executable-extension }}"
89- gh release upload $GH_RELEASE "$FROM#$TO" --clobber
9087 shell : bash
91- env :
92- GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
88+ env : { "GH_TOKEN": "${{ secrets.GITHUB_TOKEN }}" }
89+ run : |
90+ FROM='${{ steps.information.outputs.ASSET_PATH }}'
91+ TO='${{ steps.information.outputs.ASSET_NAME }}-${{ matrix.platform-name }}${{ matrix.executable-extension }}'
92+ LABEL="${{ steps.information.outputs.PROJECT_NAME }}-$TO"
93+ mv $FROM $TO
94+ gh release upload $GH_RELEASE "$TO#$LABEL" --clobber
0 commit comments