1818env :
1919 REGISTRY : ghcr.io
2020 IMAGE_NAME : ${{ github.repository }}
21+ BINARY_NAME : ${{ github.event.repository.name }}
2122
2223jobs :
2324 build :
@@ -67,24 +68,25 @@ jobs:
6768 uses : taiki-e/install-action@a1f180f99a1c725ceb0e42382d8aa2402edf1558 # v2.22.5
6869 with :
6970 tool : cross
70- - run : ${{ (!matrix.os && matrix.use-cross) && 'cross' || 'cargo' }} build --locked --release --target ${{ matrix.target }}
71+ - run : mkdir dist
72+ - run : ${{ (!matrix.os && matrix.use-cross) && 'cross' || 'cargo' }} rustc --locked --release --target=${{ matrix.target }} -- --emit=link=dist/binary
7173 - uses : actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392 # v4.0.0
7274 with :
7375 name : ${{ matrix.target }}
7476 path : |
75- target/${{ matrix.target }}/release/rust-ci-test
76- target/${{ matrix.target }}/release/rust-ci-test .exe
77+ dist/binary
78+ dist/binary .exe
7779 - name : Upload to release
7880 if : ${{ inputs.tag-name }}
79- working-directory : target/${{ matrix.target }}/release /
81+ working-directory : dist /
8082 run : |
81- if [ -e rust-ci-test .exe ]; then
82- filename="rust-ci-test -${{ inputs.tag-name }}-${{ matrix.target }}.exe"
83- mv rust-ci-test .exe "$filename"
83+ if [ -e binary .exe ]; then
84+ filename="${{ env.BINARY_NAME }} -${{ inputs.tag-name }}-${{ matrix.target }}.exe"
85+ mv binary .exe "$filename"
8486 gh release upload ${{ inputs.tag-name }} "$filename"#${{ matrix.target }} --clobber
8587 else
86- filename="rust-ci-test -${{ inputs.tag-name }}-${{ matrix.target }}"
87- mv rust-ci-test "$filename"
88+ filename="${{ env.BINARY_NAME }} -${{ inputs.tag-name }}-${{ matrix.target }}"
89+ mv binary "$filename"
8890 gh release upload ${{ inputs.tag-name }} "$filename"#${{ matrix.target }} --clobber
8991 fi
9092 docker :
@@ -101,7 +103,7 @@ jobs:
101103 - uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
102104 with :
103105 sparse-checkout : |
104- .github/workflows /build/Dockerfile
106+ .github/files /build/Dockerfile
105107 sparse-checkout-cone-mode : false
106108 - name : Download build artifact
107109 uses : actions/download-artifact@7a1cd3216ca9260cd8022db641d960b1db4d1be4 # v4.0.0
@@ -125,15 +127,15 @@ jobs:
125127 tags : |
126128 type=semver,pattern={{version}},value=${{ inputs.tag-name }}
127129 type=semver,pattern={{major}}.{{minor}},value=${{ inputs.tag-name }}
128- type=semver,pattern={{major}},value=${{ inputs.tag-name }}
130+ type=semver,pattern={{major}},value=${{ inputs.tag-name }},enable=${{ !(startsWith(github.ref, 'refs/tags/v0.') || startsWith(inputs.tag-name, 'v0.')) }}
129131 type=edge
130132 type=ref,event=branch
131133 type=sha
132134 - name : Build and push Docker image
133135 uses : docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # v5.1.0
134136 with :
135137 context : .
136- file : .github/workflows /build/Dockerfile
138+ file : .github/files /build/Dockerfile
137139 platforms : darwin/amd64,darwin/arm64,linux/amd64,linux/arm64,windows/amd64
138140 push : ${{ github.event_name != 'pull_request' }}
139141 tags : ${{ steps.meta.outputs.tags }}
0 commit comments