Merge branch 'zspace-dev' into zspace #13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: zspace | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- zspace | |
paths: | |
- version | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
goarch: [amd64, arm64] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.22.5' | |
- name: Get version from file | |
id: get_version | |
run: | | |
echo "version=$(cat version)" >> $GITHUB_ENV | |
- name: Build | |
run: CGO_ENABLED=0 GOARCH=${{ matrix.goarch }} go build -a --trimpath -ldflags="-w -s -X 'github.com/onlyLTY/dockerCopilotZspace/zspace/internal/config.Version=${{ env.version }}' -X 'github.com/onlyLTY/dockerCopilotZspace/zspace/internal/config.BuildDate=$(date)'" -o dockerCopilot-new . | |
- name: Compress binary | |
run: | | |
tar -czvf dockerCopilot-${{ matrix.goarch }}.tar.gz dockerCopilot-new | |
- name: List current directory | |
run: ls -la | |
- name: Check if release already exists | |
id: check_release | |
run: | | |
exists=$(gh release view ${{ env.version }} 2>&1 | grep "release not found" || true) | |
if [[ -z "$exists" ]]; then | |
echo "Release exists" | |
echo "RELEASE_EXISTS=true" >> $GITHUB_ENV | |
else | |
echo "Release does not exist" | |
echo "RELEASE_EXISTS=false" >> $GITHUB_ENV | |
fi | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create GitHub Release if not exists | |
if: env.RELEASE_EXISTS == 'false' | |
run: | | |
gh release create ${{ env.version }} \ | |
--title "${{ env.version }}" \ | |
--notes "Release of version ${{ env.version }}" | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload Asset for ${{ matrix.goarch }} | |
run: | | |
gh release upload ${{ env.version }} dockerCopilot-${{ matrix.goarch }}.tar.gz | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |