summaryrefslogtreecommitdiff
path: root/.github/workflows/release.yml
blob: 94fbee3f529c0f0a0b3775541c3e68c236540145 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
name: Build Go binaries on github release

on:
  release:
    types: [created]  # only runs when you manually click "Create release" matching a tag

permissions:
  contents: write
  packages: write

jobs:
  publish-binaries:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        goos: [linux, darwin, windows]
        goarch: ["386", amd64, arm64]
        exclude:
          - goarch: "386"  # darwin/386 not supported
            goos: darwin

    steps:
      - uses: actions/checkout@v4

      - name: Set RELEASE_TAG env
        run: echo RELEASE_TAG=$(echo ${GITHUB_REF}) >> ${GITHUB_ENV}

      - name: Set COMMIT env
        run: echo COMMIT=$(git rev-parse --short=7 HEAD) >> ${GITHUB_ENV}

      - name: Set BUILD_DATE env
        run: echo BUILD_DATE=$(date +%s) >> ${GITHUB_ENV}

      - uses: wangyoucao577/go-release-action@v1
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          goos: ${{ matrix.goos }}
          goarch: ${{ matrix.goarch }}
          binary_name: eko
          ldflags: >
            -X "github.com/kyren223/eko/embeds.Version=${{ env.RELEASE_TAG }}"
            -X "github.com/kyren223/eko/embeds.Commit=${{ env.COMMIT }}"
            -X "github.com/kyren223/eko/embeds.BuildDate=${{ env.BUILD_DATE }}"
          project_path: ./cmd/client
          asset_name: 'eko-${{ matrix.goos }}-${{ matrix.goarch }}'
          extra_files: LICENSE README.md
          sha256sum: true
          md5sum: false
          overwrite: true