Skip to content

Commit bcaaa54

Browse files
authored
Always build and archive artifacts (#122)
1 parent 1046067 commit bcaaa54

1 file changed

Lines changed: 23 additions & 3 deletions

File tree

.github/workflows/release.yml

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ name: Release
22

33
on:
44
release:
5-
types: [ created ]
5+
types: [created]
6+
push:
7+
branches: [master]
8+
pull_request:
69

710
env:
811
CARGO_TERM_COLOR: always
@@ -27,18 +30,35 @@ jobs:
2730

2831
steps:
2932
- uses: actions/checkout@v2
30-
- name: Get tag
31-
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
33+
34+
- name: Get tag or commit
35+
run: |
36+
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
37+
echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
38+
else
39+
SHORT_SHA=$(echo "${GITHUB_SHA}" | cut -c1-7)
40+
echo "RELEASE_VERSION=${SHORT_SHA}" >> $GITHUB_ENV
41+
fi
3242
shell: bash
43+
3344
- name: Build
3445
run: |
3546
cargo build --release
47+
3648
- name: Compress
3749
run: |
3850
cp -f target/release/$REPO${{ matrix.bin_extension }} .
3951
tar -czf release.tar.gz $REPO${{ matrix.bin_extension }}
4052
shell: bash
53+
54+
- name: Archive build artifacts
55+
uses: actions/upload-artifact@v4
56+
with:
57+
name: ${{ env.REPO }}-${{ env.RELEASE_VERSION }}-${{ matrix.os_name }}
58+
path: release.tar.gz
59+
4160
- name: Upload binaries to release
61+
if: github.event_name == 'release'
4262
uses: svenstaro/upload-release-action@v2
4363
with:
4464
repo_token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)