mirror of
https://github.com/gocsaf/csaf.git
synced 2025-12-22 11:55:40 +01:00
Improve release process
* Add only uploader and checker binaries and basic documentation to windows dist archive. Prepare for specific docs. * Improve Makefile to be able to use github lightweight git tags for release version calculation. * Change github action to use the make dist target for asset uploading. * Remove matrix strategy and single go release actions. * Update go setup action to use latest version. * Use action to upload both distribution archives created by make. * Improve the pattern to leave tagged release version numbers like `0.2.2-alpha` alone and only increase version numbers where git describe has added a string starting with a number.
This commit is contained in:
parent
8a1ebe0b7a
commit
102a0bb6c1
2 changed files with 29 additions and 38 deletions
51
.github/workflows/release.yml
vendored
51
.github/workflows/release.yml
vendored
|
|
@ -6,38 +6,23 @@ on:
|
|||
|
||||
jobs:
|
||||
releases-matrix:
|
||||
name: Release Go Binary
|
||||
name: Release Go binaries
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
goos: [linux, windows]
|
||||
goarch: [amd64]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: wangyoucao577/go-release-action@v1.25
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
goos: ${{ matrix.goos }}
|
||||
goarch: ${{ matrix.goarch }}
|
||||
goversion: "latest"
|
||||
build_flags: -v
|
||||
project_path: ./cmd/csaf_checker
|
||||
binary_name: csaf_checker
|
||||
- uses: wangyoucao577/go-release-action@v1.25
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
goos: ${{ matrix.goos }}
|
||||
goarch: ${{ matrix.goarch }}
|
||||
goversion: "latest"
|
||||
build_flags: -v
|
||||
project_path: ./cmd/csaf_provider
|
||||
binary_name: csaf_provider
|
||||
- uses: wangyoucao577/go-release-action@v1.25
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
goos: ${{ matrix.goos }}
|
||||
goarch: ${{ matrix.goarch }}
|
||||
goversion: "latest"
|
||||
build_flags: -v
|
||||
project_path: ./cmd/csaf_uploader
|
||||
binary_name: csaf_uploader
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: '^1.18.2'
|
||||
|
||||
- name: Build
|
||||
run: make dist
|
||||
|
||||
- name: Upload release assets
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
files: |
|
||||
dist/csaf_distribution-*.zip
|
||||
dist/csaf_distribution-*.tar.gz
|
||||
|
|
|
|||
16
Makefile
16
Makefile
|
|
@ -41,12 +41,15 @@ tag_checked_out:
|
|||
# into a semver version. For this we increase the PATCH number, so that
|
||||
# any commit after a tag is considered newer than the semver from the tag
|
||||
# without an optional 'v'
|
||||
GITDESC := $(shell git describe)
|
||||
# Note we need `--tags` because github release only creates lightweight tags
|
||||
# (see feature request https://github.com/github/feedback/discussions/4924)
|
||||
GITDESC := $(shell git describe --tags)
|
||||
GITDESCPATCH := $(shell echo '$(GITDESC)' | sed -E 's/v?[0-9]+\.[0-9]+\.([0-9]+)[-+]?.*/\1/')
|
||||
SEMVERPATCH := $(shell echo $$(( $(GITDESCPATCH) + 1 )))
|
||||
# Hint: The regexp in the next line only matches if there is a hyphen (`-`)
|
||||
# and we can assume that git describe has added a string after the tag
|
||||
SEMVER := $(shell echo '$(GITDESC)' | sed -E 's/v?([0-9]+\.[0-9]+\.)([0-9]+)(-.*)/\1$(SEMVERPATCH)\3/' )
|
||||
# followed by a number, by which we assume that git describe
|
||||
# has added a string after the tag
|
||||
SEMVER := $(shell echo '$(GITDESC)' | sed -E 's/v?([0-9]+\.[0-9]+\.)([0-9]+)(-[1-9].*)/\1$(SEMVERPATCH)\3/' )
|
||||
testsemver:
|
||||
@echo from \'$(GITDESC)\' transformed to \'$(SEMVER)\'
|
||||
|
||||
|
|
@ -70,8 +73,11 @@ build_linux build_win:
|
|||
DISTDIR := csaf_distribution-$(SEMVER)
|
||||
dist: build_linux build_win
|
||||
mkdir -p dist
|
||||
mkdir dist/$(DISTDIR)-windows-amd64
|
||||
cp -r README.md docs bin-windows-amd64 dist/$(DISTDIR)-windows-amd64
|
||||
mkdir -p dist/$(DISTDIR)-windows-amd64/bin-windows-amd64
|
||||
cp README.md dist/$(DISTDIR)-windows-amd64
|
||||
cp bin-windows-amd64/csaf_uploader.exe bin-windows-amd64/csaf_checker.exe dist/$(DISTDIR)-windows-amd64/bin-windows-amd64/
|
||||
mkdir -p dist/$(DISTDIR)-windows-amd64/docs
|
||||
#cp docs/csaf_uploader.md docs/csaf_checker.md dist/$(DISTDIR)-windows-amd64/docs
|
||||
mkdir dist/$(DISTDIR)-gnulinux-amd64
|
||||
cp -r README.md docs bin-linux-amd64 dist/$(DISTDIR)-gnulinux-amd64
|
||||
cd dist/ ; zip -r $(DISTDIR)-windows-amd64.zip $(DISTDIR)-windows-amd64/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue