From 27601c0e4c00a0a4facb8bd6219f6b32dde85afb Mon Sep 17 00:00:00 2001 From: Mogyuchi Date: Sun, 25 Aug 2024 09:00:42 +0900 Subject: [PATCH] build: use BINARY_NAME (#356) --- .github/workflows/build.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9f1df97..47b9070 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -78,28 +78,28 @@ jobs: with: tool: cross - run: mkdir dist - - run: ${{ (!matrix.os && matrix.use-cross) && 'cross' || 'cargo' }} rustc --locked ${{ github.ref_name == github.event.repository.default_branch && '--release' || '' }} --no-default-features --target=${{ matrix.target }} -- --emit=link=dist/binary + - run: ${{ (!matrix.os && matrix.use-cross) && 'cross' || 'cargo' }} rustc --locked ${{ github.ref_name == github.event.repository.default_branch && '--release' || '' }} --no-default-features --target=${{ matrix.target }} -- --emit=link=dist/${{ needs.env.outputs.BINARY_NAME }} - uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 with: name: ${{ matrix.target }} path: | - dist/binary - dist/binary.exe + dist/${{ needs.env.outputs.BINARY_NAME }} + dist/${{ needs.env.outputs.BINARY_NAME }}.exe - name: Upload to release if: ${{ inputs.tag-name }} working-directory: dist/ run: | - if [ -e binary.exe ]; then + if [ -e ${{ needs.env.outputs.BINARY_NAME }}.exe ]; then filename="${{ needs.env.outputs.BINARY_NAME }}-${{ inputs.tag-name }}-${{ matrix.target }}.exe" - mv binary.exe "$filename" + mv ${{ needs.env.outputs.BINARY_NAME }}.exe "$filename" gh release upload ${{ inputs.tag-name }} "$filename"#${{ matrix.target }} --clobber else filename="${{ needs.env.outputs.BINARY_NAME }}-${{ inputs.tag-name }}-${{ matrix.target }}" - mv binary "$filename" + mv ${{ needs.env.outputs.BINARY_NAME }} "$filename" gh release upload ${{ inputs.tag-name }} "$filename"#${{ matrix.target }} --clobber fi image: - needs: build + needs: [env, build] if: ${{ github.event_name != 'pull_request' }} permissions: packages: write @@ -137,8 +137,8 @@ jobs: run: | build() { newcontainer=$(buildah from --platform="$1" scratch) - buildah copy --chmod=0755 $newcontainer ./artifact/"$2"/binary /binary - buildah config --entrypoint='["./binary"]' $newcontainer + buildah copy --chmod=0755 $newcontainer ./artifact/"$2"/${{ needs.env.outputs.BINARY_NAME }} /${{ needs.env.outputs.BINARY_NAME }} + buildah config --entrypoint='["./${{ needs.env.outputs.BINARY_NAME }}"]' $newcontainer buildah config --author="Mogyuchi" $(awk '{print "--label=" $0}' <<< "${{ steps.meta.outputs.labels }}") $newcontainer buildah inspect $newcontainer