Skip to content

Commit

Permalink
actions: Upload git artifacts (on push) and assets (on tag)
Browse files Browse the repository at this point in the history
Special care taken to ensure Windows exe extension preserved.
  • Loading branch information
shasheene committed Nov 2, 2024
1 parent 4e20b36 commit 4fceca4
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,27 @@ jobs:
env:
GOOS: ${{ matrix.go-os-target }}
GOARCH: ${{ matrix.go-arch-target }}


- name: Upload built assets (on tag push)
uses: softprops/action-gh-release@v2
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
with:
files: build/*

# Upload GitHub Action workflow *artifacts*. Note "artifacts" are a different concept to GitHub release assets.
# The former is available on each GitHub Actions workflow run. The latter is associated with only a pushed tag.

- name: Upload release artifacts except Windows
uses: actions/upload-artifact@v4
with:
name: "protodot-${{ matrix.go-os-target }}-${{ matrix.go-arch-target }}"
path: "build/protodot-${{ matrix.go-os-target }}-${{ matrix.go-arch-target }}"

# Ensure Windows assets have exe extension
- name: Upload remaining Windows release artifacts (with 'exe' extension)
uses: actions/upload-artifact@v3
if: matrix.go-os-target == 'windows'
with:
name: "protodot-${{ matrix.go-os-target }}-${{ matrix.go-arch-target }}.exe"
path: "build/protodot-${{ matrix.go-os-target }}-${{ matrix.go-arch-target }}.exe"

0 comments on commit 4fceca4

Please sign in to comment.