mirror of
https://github.com/gocsaf/csaf.git
synced 2025-12-22 18:15:42 +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
47
.github/workflows/release.yml
vendored
47
.github/workflows/release.yml
vendored
|
|
@ -6,38 +6,23 @@ on:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
releases-matrix:
|
releases-matrix:
|
||||||
name: Release Go Binary
|
name: Release Go binaries
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
goos: [linux, windows]
|
|
||||||
goarch: [amd64]
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- name: Checkout
|
||||||
- uses: wangyoucao577/go-release-action@v1.25
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@v3
|
||||||
with:
|
with:
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
go-version: '^1.18.2'
|
||||||
goos: ${{ matrix.goos }}
|
|
||||||
goarch: ${{ matrix.goarch }}
|
- name: Build
|
||||||
goversion: "latest"
|
run: make dist
|
||||||
build_flags: -v
|
|
||||||
project_path: ./cmd/csaf_checker
|
- name: Upload release assets
|
||||||
binary_name: csaf_checker
|
uses: softprops/action-gh-release@v1
|
||||||
- uses: wangyoucao577/go-release-action@v1.25
|
|
||||||
with:
|
with:
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
files: |
|
||||||
goos: ${{ matrix.goos }}
|
dist/csaf_distribution-*.zip
|
||||||
goarch: ${{ matrix.goarch }}
|
dist/csaf_distribution-*.tar.gz
|
||||||
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
|
|
||||||
|
|
|
||||||
16
Makefile
16
Makefile
|
|
@ -41,12 +41,15 @@ tag_checked_out:
|
||||||
# into a semver version. For this we increase the PATCH number, so that
|
# 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
|
# any commit after a tag is considered newer than the semver from the tag
|
||||||
# without an optional 'v'
|
# 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/')
|
GITDESCPATCH := $(shell echo '$(GITDESC)' | sed -E 's/v?[0-9]+\.[0-9]+\.([0-9]+)[-+]?.*/\1/')
|
||||||
SEMVERPATCH := $(shell echo $$(( $(GITDESCPATCH) + 1 )))
|
SEMVERPATCH := $(shell echo $$(( $(GITDESCPATCH) + 1 )))
|
||||||
# Hint: The regexp in the next line only matches if there is a hyphen (`-`)
|
# 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
|
# followed by a number, by which we assume that git describe
|
||||||
SEMVER := $(shell echo '$(GITDESC)' | sed -E 's/v?([0-9]+\.[0-9]+\.)([0-9]+)(-.*)/\1$(SEMVERPATCH)\3/' )
|
# 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:
|
testsemver:
|
||||||
@echo from \'$(GITDESC)\' transformed to \'$(SEMVER)\'
|
@echo from \'$(GITDESC)\' transformed to \'$(SEMVER)\'
|
||||||
|
|
||||||
|
|
@ -70,8 +73,11 @@ build_linux build_win:
|
||||||
DISTDIR := csaf_distribution-$(SEMVER)
|
DISTDIR := csaf_distribution-$(SEMVER)
|
||||||
dist: build_linux build_win
|
dist: build_linux build_win
|
||||||
mkdir -p dist
|
mkdir -p dist
|
||||||
mkdir dist/$(DISTDIR)-windows-amd64
|
mkdir -p dist/$(DISTDIR)-windows-amd64/bin-windows-amd64
|
||||||
cp -r README.md docs bin-windows-amd64 dist/$(DISTDIR)-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
|
mkdir dist/$(DISTDIR)-gnulinux-amd64
|
||||||
cp -r README.md docs bin-linux-amd64 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/
|
cd dist/ ; zip -r $(DISTDIR)-windows-amd64.zip $(DISTDIR)-windows-amd64/
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue