Change crossbuild to go-release-binaries.

Reason: crossbuild action is deprecated and does not support current
latest versions of golang.
This commit is contained in:
2022-10-17 11:44:25 +01:00
parent a89c69dda8
commit 43b49666b6
+83 -47
View File
@@ -105,6 +105,26 @@ jobs:
with: with:
args: ./... args: ./...
create-dummy-release:
needs: [ prepare, test, code_scans ]
name: Create empty release
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Get list of the commits since last release
run: |
echo "$(git log $(git describe --tags --abbrev=0)..HEAD --pretty=format:"%h %s")" > .release_notes
- name: Create empty release
uses: ncipollo/release-action@v1
with:
bodyFile: ./.release_notes
name: version ${{ needs.prepare.outputs.RELEASE_VERSION }}
token: ${{ secrets.GHCR_TOKEN }}
tag: ${{ needs.prepare.outputs.RELEASE_VERSION }}
prerelease: ${{ github.ref != 'refs/heads/master' && github.ref != 'refs/heads/main' }}
allowUpdates: true
build: build:
needs: [ prepare, test, code_scans ] needs: [ prepare, test, code_scans ]
name: Docker image build (regular:multiarch) name: Docker image build (regular:multiarch)
@@ -165,60 +185,76 @@ jobs:
# fail-build: false # fail-build: false
build-binary: build-binary:
needs: [ prepare, test, code_scans ] needs: [ prepare, test, code_scans, create-dummy-release ]
name: Binary compilation and release name: Binary compilation and release
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
matrix:
# build and publish in parallel: linux/386, linux/amd64, linux/arm64, windows/386, windows/amd64, darwin/amd64, darwin/arm64
goos: [linux, windows, darwin]
goarch: ["386", amd64, arm64]
exclude:
- goarch: "386"
goos: darwin
- goarch: arm64
goos: windows
continue-on-error: [true]
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Compile binary - name: Compile binary
uses: thatisuday/go-cross-build@v1.1.0 uses: wangyoucao577/go-release-action@v1.32
with: with:
platforms: linux/amd64,darwin/amd64,windows/amd64,linux/arm64,darwin/amd64,darwin/arm64 github_token: ${{ secrets.GHCR_TOKEN }}
name: semver-gen goos: ${{ matrix.goos }}
package: ./ goarch: ${{ matrix.goarch }}
compress: false
dest: dist
ldflags: -s -w -X main.PKG_VERSION=${{ needs.prepare.outputs.RELEASE_VERSION }} ldflags: -s -w -X main.PKG_VERSION=${{ needs.prepare.outputs.RELEASE_VERSION }}
- name: Get list of the commits since last release project_path: .
run: | binary_name: semver-gen
echo "$(git log $(git describe --tags --abbrev=0)..HEAD --pretty=format:"%h %s")" > .release_notes asset_name: semver-gen-${{ matrix.goos }}-${{ matrix.goarch }}
- name: Create Release release_name: version ${{ needs.prepare.outputs.RELEASE_VERSION }}
id: create_release release_tag: ${{ needs.prepare.outputs.RELEASE_VERSION }}
uses: marvinpinto/action-automatic-releases@latest compress_assets: false
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' }} retry: 10
env: overwrite: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} pre_command: export GODEBUG=http2client=0
with:
repo_token: ${{ secrets.GITHUB_TOKEN }} # - name: Create Release
files: dist/semver-gen-* # id: create_release
automatic_release_tag: ${{ needs.prepare.outputs.RELEASE_VERSION }} # uses: marvinpinto/action-automatic-releases@latest
title: version ${{ needs.prepare.outputs.RELEASE_VERSION }} # if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' }}
# tag: ${{ needs.prepare.outputs.RELEASE_VERSION }} # env:
# name: ${{ needs.prepare.outputs.RELEASE_VERSION }} # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# body_path: .release_notes # with:
# draft: false # repo_token: ${{ secrets.GITHUB_TOKEN }}
prerelease: ${{ github.ref != 'refs/heads/master' && github.ref != 'refs/heads/main' }} # files: dist/semver-gen-*
- name: Delete previous v1 release asset # automatic_release_tag: ${{ needs.prepare.outputs.RELEASE_VERSION }}
uses: mknejp/delete-release-assets@v1 # title: version ${{ needs.prepare.outputs.RELEASE_VERSION }}
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' }} # # tag: ${{ needs.prepare.outputs.RELEASE_VERSION }}
with: # # name: ${{ needs.prepare.outputs.RELEASE_VERSION }}
token: ${{ github.token }} # # body_path: .release_notes
fail-if-no-assets: false # # draft: false
fail-if-no-release: false # prerelease: ${{ github.ref != 'refs/heads/master' && github.ref != 'refs/heads/main' }}
tag: v1 # - name: Delete previous v1 release asset
assets: 'semver-gen-*' # uses: mknejp/delete-release-assets@v1
- name: Create Release V1 # if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' }}
id: create_release_global # with:
uses: marvinpinto/action-automatic-releases@latest # token: ${{ github.token }}
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' }} # fail-if-no-assets: false
env: # fail-if-no-release: false
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # tag: v1
with: # assets: 'semver-gen-*'
repo_token: ${{ secrets.GITHUB_TOKEN }} # - name: Create Release V1
files: dist/semver-gen-* # id: create_release_global
automatic_release_tag: v1 # uses: marvinpinto/action-automatic-releases@latest
title: version v1:${{ needs.prepare.outputs.RELEASE_VERSION }} # if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' }}
prerelease: ${{ github.ref != 'refs/heads/master' && github.ref != 'refs/heads/main' }} # env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# repo_token: ${{ secrets.GITHUB_TOKEN }}
# files: dist/semver-gen-*
# automatic_release_tag: v1
# title: version v1:${{ needs.prepare.outputs.RELEASE_VERSION }}
# prerelease: ${{ github.ref != 'refs/heads/master' && github.ref != 'refs/heads/main' }}