Skip to content

Commit

Permalink
Update reuse-build.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Go0p authored May 22, 2024
1 parent 7e6d678 commit 47b483e
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions .github/workflows/reuse-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,13 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Set up Docker Buildx
- name: Set up Docker Buildx and Go
if: inputs.os == 'centos7-amd64'
uses: docker/setup-buildx-action@v1

- name: Set up Go
uses: actions/setup-go@v2
if: inputs.os != 'centos7-amd64'
with:
go-version: 1.20.3

Expand Down Expand Up @@ -100,14 +101,23 @@ jobs:
go build -ldflags "-s -w -X 'main.goVersion=$(go version)' -X 'main.gitHash=$(git show -s --format=%H)' -X 'main.buildTime=$(git show -s --format=%cd)' -X 'main.yakVersion=${{ env.YAK_TAG }}'" -o ./yak_windows_amd64.exe -v common/yak/cmd/yak.go
if: runner.os == 'Windows'

- name: Install Go 1.20.3 in Docker container
if: inputs.os == 'centos7-amd64'
run: |
docker run --rm centos:7 /bin/bash -c "
yum install -y gcc make && \
yum install -y https://dl.google.com/go/go1.20.3.linux-amd64.tar.gz && \
export PATH=$PATH:/usr/local/go/bin
"
- name: Build For CentOS 7
if: inputs.os == 'centos7-amd64'
run: |
docker run --rm -v $PWD:/workspace -w /workspace centos:7 /bin/bash -c "
yum install -y gcc make && \
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -ldflags '-linkmode external -extldflags -static -s -w -X main.goVersion=$(go version) -X main.gitHash=$(git show -s --format=%H) -X main.buildTime=$(git show -s --format=%cd) -X main.yakVersion=${{ env.YAK_TAG }}' -o ./yak_centos7_amd64 common/yak/cmd/yak.go && ls
"
- name: Upload Artifacts Windows
uses: actions/upload-artifact@v2
if: runner.os == 'Windows'
Expand Down

0 comments on commit 47b483e

Please sign in to comment.