|
1 |
| -name: Release |
| 1 | +name: Build and Release |
2 | 2 |
|
3 | 3 | on:
|
4 | 4 | push:
|
|
8 | 8 | jobs:
|
9 | 9 | build:
|
10 | 10 | runs-on: ubuntu-latest
|
| 11 | + strategy: |
| 12 | + matrix: |
| 13 | + goos: [linux, windows, darwin] |
| 14 | + goarch: [amd64, arm64] |
| 15 | + |
11 | 16 | steps:
|
12 |
| - - uses: actions/checkout@v4 |
| 17 | + - name: Checkout code |
| 18 | + uses: actions/checkout@v4 |
13 | 19 |
|
14 | 20 | - name: Set up Go
|
15 | 21 | uses: actions/setup-go@v4
|
16 | 22 | with:
|
17 |
| - go-version: "1.20" |
| 23 | + go-version: "1.23" |
18 | 24 |
|
19 | 25 | - name: Build
|
20 |
| - run: go build -v ./... |
| 26 | + env: |
| 27 | + GOOS: ${{ matrix.goos }} |
| 28 | + GOARCH: ${{ matrix.goarch }} |
| 29 | + run: | |
| 30 | + go build -o blast-${{ matrix.goos }}-${{ matrix.goarch }} |
| 31 | +
|
| 32 | + - name: Upload artifact |
| 33 | + uses: actions/upload-artifact@v4 |
| 34 | + with: |
| 35 | + name: blast-${{ matrix.goos }}-${{ matrix.goarch }} |
| 36 | + path: blast-${{ matrix.goos }}-${{ matrix.goarch }} |
| 37 | + |
| 38 | + release: |
| 39 | + needs: build |
| 40 | + runs-on: ubuntu-latest |
| 41 | + steps: |
| 42 | + - name: Checkout code |
| 43 | + uses: actions/checkout@v4 |
21 | 44 |
|
22 |
| - - name: Test |
23 |
| - run: go test -v ./... |
| 45 | + - name: Download build artifacts |
| 46 | + uses: actions/download-artifact@v4 |
| 47 | + with: |
| 48 | + name: blast-${{ matrix.goos }}-${{ matrix.goarch }} |
| 49 | + path: ./artifacts |
| 50 | + |
| 51 | + - name: Create GitHub Release |
| 52 | + id: create_release |
| 53 | + uses: actions/create-release@v1 |
| 54 | + env: |
| 55 | + GITHUB_TOKEN: ${{ secrets.PERSONAL_GITHUB_TOKEN }} |
| 56 | + with: |
| 57 | + tag_name: ${{ github.ref_name }} |
| 58 | + release_name: Release ${{ github.ref_name }} |
| 59 | + draft: false |
| 60 | + prerelease: false |
| 61 | + |
| 62 | + - name: Upload release assets |
| 63 | + uses: actions/upload-release-asset@v1 |
| 64 | + env: |
| 65 | + GITHUB_TOKEN: ${{ secrets.PERSONAL_GITHUB_TOKEN }} |
| 66 | + with: |
| 67 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 68 | + asset_path: ./artifacts/blast-* |
| 69 | + asset_name: blast-${{ matrix.goos }}-${{ matrix.goarch }} |
| 70 | + asset_content_type: application/octet-stream |
0 commit comments