| 1 | on: |
| 2 | push: |
| 3 | tags: |
| 4 | - 'v*.*.*' |
| 5 | |
| 6 | name: Build |
| 7 | jobs: |
| 8 | publish: |
| 9 | strategy: |
| 10 | matrix: |
| 11 | os: |
| 12 | - linux |
| 13 | - darwin |
| 14 | - windows |
| 15 | arch: |
| 16 | - amd64 |
| 17 | - 386 |
| 18 | - arm64 |
| 19 | - arm |
| 20 | include: |
| 21 | - os: linux |
| 22 | arch: amd64 |
| 23 | artifact_name: dasel_linux_amd64 |
| 24 | asset_name: dasel_linux_amd64 |
| 25 | test_version: true |
| 26 | - os: linux |
| 27 | arch: 386 |
| 28 | artifact_name: dasel_linux_386 |
| 29 | asset_name: dasel_linux_386 |
| 30 | test_version: false |
| 31 | - os: darwin |
| 32 | arch: amd64 |
| 33 | artifact_name: dasel_darwin_amd64 |
| 34 | asset_name: dasel_darwin_amd64 |
| 35 | test_version: false |
| 36 | - os: darwin |
| 37 | arch: arm64 |
| 38 | artifact_name: dasel_darwin_arm64 |
| 39 | asset_name: dasel_darwin_arm64 |
| 40 | test_version: false |
| 41 | - os: windows |
| 42 | arch: amd64 |
| 43 | artifact_name: dasel_windows_amd64.exe |
| 44 | asset_name: dasel_windows_amd64.exe |
| 45 | test_version: false |
| 46 | - os: windows |
| 47 | arch: 386 |
| 48 | artifact_name: dasel_windows_386.exe |
| 49 | asset_name: dasel_windows_386.exe |
| 50 | test_version: false |
| 51 | - os: linux |
| 52 | arch: arm64 |
| 53 | artifact_name: dasel_linux_arm64 |
| 54 | asset_name: dasel_linux_arm64 |
| 55 | test_version: false |
| 56 | - os: linux |
| 57 | arch: arm |
| 58 | artifact_name: dasel_linux_arm32 |
| 59 | asset_name: dasel_linux_arm32 |
| 60 | test_version: false |
| 61 | exclude: |
| 62 | - os: darwin |
| 63 | arch: 386 |
| 64 | - os: windows |
| 65 | arch: arm64 |
| 66 | - os: windows |
| 67 | arch: arm |
| 68 | - os: darwin |
| 69 | arch: arm |
| 70 | name: Build ${{ matrix.os }} ${{ matrix.arch }} |
| 71 | runs-on: ubuntu-latest |
| 72 | steps: |
| 73 | - uses: actions/checkout@v6 |
| 74 | - uses: actions/setup-go@v6 |
| 75 | with: |
| 76 | go-version: '^1.25.0' |
| 77 | - name: Set env |
| 78 | run: echo RELEASE_VERSION=${GITHUB_REF:10} >> $GITHUB_ENV |
| 79 | - name: Build |
| 80 | run: GOOS=${{ matrix.os }} GOARCH=${{ matrix.arch }} CGO_ENABLED=0 go build -o target/release/${{ matrix.artifact_name }} -ldflags="-w -s -X 'github.com/tomwright/dasel/v3/internal.Version=${{ env.RELEASE_VERSION }}'" ./cmd/dasel |
| 81 | - name: Test version |
| 82 | if: matrix.test_version == true |
| 83 | run: ./target/release/${{ matrix.artifact_name }} version |
| 84 | - name: Gzip binaries |
| 85 | run: gzip -c ./target/release/${{ matrix.artifact_name }} > ./target/release/${{ matrix.artifact_name }}.gz |
| 86 | - name: Upload binaries to release |
| 87 | uses: svenstaro/upload-release-action@v2 |
| 88 | with: |
| 89 | repo_token: ${{ secrets.GITHUB_TOKEN }} |
| 90 | file: target/release/${{ matrix.artifact_name }} |
| 91 | asset_name: ${{ matrix.asset_name }} |
| 92 | tag: ${{ github.ref }} |
| 93 | - name: Upload gzip binaries to release |
| 94 | uses: svenstaro/upload-release-action@v2 |
| 95 | with: |
| 96 | repo_token: ${{ secrets.GITHUB_TOKEN }} |
| 97 | file: target/release/${{ matrix.artifact_name }}.gz |
| 98 | asset_name: ${{ matrix.asset_name }}.gz |
| 99 | tag: ${{ github.ref }} |