Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI/CD Change. Pack binaries, Licence and summaries into one archive file #9

Merged
merged 1 commit into from
Feb 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 20 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: ${{ env.go-version }}

Expand Down Expand Up @@ -81,35 +81,42 @@ jobs:
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: ${{ env.go-version }}

- name: Echo Go version
run: go version

- name: Build with different arch
run: |
export GOOS=$(echo ${{ matrix.platforms }} | cut -d '/' -f 1)
export GOARCH=$(echo ${{ matrix.platforms }} | cut -d '/' -f 2)
export GOARM=$(echo ${{ matrix.platforms }} | cut -d '/' -f 3 | cut -d 'v' -f 2)
if [[ "x$GOOS" == "xwindows" ]]; then
make build CMD_NAME="builds/${{ env.cmd-name }}_${GOOS}_${GOARCH}.exe"
elif [[ "x$GOARM" != "x" ]]; then
make build CMD_NAME="builds/${{ env.cmd-name }}_${GOOS}_${GOARCH}v${GOARM}"
if [[ "$GOOS" == "windows" ]]; then
make build CMD_NAME="builds/${{ env.cmd-name }}.exe"
else
make build CMD_NAME="builds/${{ env.cmd-name }}_${GOOS}_${GOARCH}"
make build CMD_NAME="builds/${{ env.cmd-name }}"
fi

- name: Create checksums
- name: Create checksum
if: startsWith(github.ref, 'refs/tags/v')
working-directory: builds
run: |
find . -type f -exec shasum -a 256 -b {} + | sed 's# \*\./# *#' | while read sum file; do echo "$sum $file" > "${file#\*}".sha256; done

- name: List artifacts
- name: Create archive
if: startsWith(github.ref, 'refs/tags/v')
run: tree -nh builds
run: |
export GOOS=$(echo ${{ matrix.platforms }} | cut -d '/' -f 1)
export GOARCH=$(echo ${{ matrix.platforms }} | cut -d '/' -f 2)
export GOARM=$(echo ${{ matrix.platforms }} | cut -d '/' -f 3 | cut -d 'v' -f 2)
export ARCHIVE_NAME=$(echo "${{ env.cmd-name }}-${GOOS}-${GOARCH}$(if [ -n "${GOARM}" ]; then echo v${GOARM}; fi).$(if [ "${GOOS}" = "windows" ]; then echo "zip"; else echo "tar.gz"; fi)")
cp LICENSE builds/
cd builds
if [[ "$GOOS" == "windows" ]]; then
zip "${ARCHIVE_NAME}" *
else
tar -czvf "${ARCHIVE_NAME}" *
fi
find . -maxdepth 1 -type f ! -name ${ARCHIVE_NAME} -exec rm -f {} +

- name: GitHub Release
if: startsWith(github.ref, 'refs/tags/v')
Expand Down