Update uyuni-tools.spec #30
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
# SPDX-FileCopyrightText: 2023 SUSE LLC | |
# | |
# SPDX-License-Identifier: Apache-2.0 | |
name: Build | |
on: | |
pull_request: | |
types: | |
- opened | |
- reopened | |
- synchronize | |
release: | |
types: | |
- published | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-tags: true | |
fetch-depth: 0 | |
- name: Setup Go ${{ matrix.go-version }} | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.20' | |
- name: Install dependencies | |
run: | | |
go get ./... | |
- name: Compute version | |
run: | | |
tag=$(git describe --tags --abbrev=0) | |
version=$(git describe --tags --abbrev=0 | cut -f 3 -d '-') | |
offset=$(git rev-list --count ${tag}..) | |
echo "VERSION=$tag-$offset" >> "$GITHUB_ENV" | |
- name: Build | |
run: | | |
mkdir -p ./bin | |
go build \ | |
-tags netgo \ | |
-ldflags "-X github.com/uyuni-project/uyuni-tools/shared/utils.Version=${{ env.VERSION }}" \ | |
-o ./bin \ | |
./... | |
- name: Build with all tags | |
run: | | |
mkdir -p ./bin | |
go build \ | |
-tags netgo,nok8s,ptf \ | |
-ldflags "-X github.com/uyuni-project/uyuni-tools/shared/utils.Version=${{ env.VERSION }}" \ | |
-o ./bin \ | |
./... | |
- name: Test with the Go CLI | |
run: go test ./... | |
- name: Upload binaries | |
uses: actions/upload-artifact@v4 | |
with: | |
name: binaries | |
path: ./bin/* |