Skip to content

Commit 9ba57d0

Browse files
committed
ci: add release workflow + updates
1 parent d449125 commit 9ba57d0

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

.github/workflows/release.yml

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
push:
55
tags:
66
- "v*" # dispara quando fizer push de uma tag vX.Y.Z
7-
workflow_dispatch: # permite correr manualmente (build artefactos mas não publica release)
7+
workflow_dispatch: # permite correr manualmente
88

99
concurrency:
1010
group: release-${{ github.ref }}
@@ -32,7 +32,7 @@ jobs:
3232
CGO_ENABLED: 0
3333
APP_NAME: sharepoint-client
3434
MAIN_PKG: ./cmd/sharepoint-client
35-
VERSION: ${{ github.ref_name }} # ex.: v0.3.0
35+
VERSION: ${{ github.ref_name }} # ex.: v1.0.3
3636

3737
steps:
3838
- name: Checkout
@@ -84,17 +84,22 @@ jobs:
8484
- name: Generate checksums
8585
shell: bash
8686
run: |
87+
shopt -s nullglob
8788
cd dist
88-
ls -1 *.tar.gz *.zip 2>/dev/null | xargs -r sha256sum | tee "checksums_${VERSION}.txt"
89+
files=( *.tar.gz *.zip )
90+
if [ ${#files[@]} -gt 0 ]; then
91+
sha256sum "${files[@]}" | tee "checksums_${VERSION}_${{ matrix.goos }}_${{ matrix.goarch }}.txt"
92+
else
93+
echo "no artifacts to checksum" | tee "checksums_${VERSION}_${{ matrix.goos }}_${{ matrix.goarch }}.txt"
94+
fi
8995
9096
- name: Upload build artifacts
9197
uses: actions/upload-artifact@v4
9298
with:
93-
name: dist
99+
name: dist-${{ matrix.goos }}-${{ matrix.goarch }}
94100
path: dist/**
95101

96102
release:
97-
if: startsWith(github.ref, 'refs/tags/')
98103
name: Create GitHub Release
99104
runs-on: ubuntu-latest
100105
needs: build
@@ -105,8 +110,19 @@ jobs:
105110
- name: Download artifacts
106111
uses: actions/download-artifact@v4
107112
with:
108-
name: dist
113+
pattern: dist-*
109114
path: dist
115+
merge-multiple: true
116+
117+
- name: Combine checksums
118+
shell: bash
119+
run: |
120+
shopt -s nullglob
121+
cd dist
122+
files=( *.tar.gz *.zip )
123+
if [ ${#files[@]} -gt 0 ]; then
124+
sha256sum "${files[@]}" | tee "checksums_${{ github.ref_name }}.txt"
125+
fi
110126
111127
- name: Publish GitHub Release
112128
uses: softprops/action-gh-release@v2

0 commit comments

Comments
 (0)