mirror of
https://github.com/lukaszraczylo/semver-generator.git
synced 2026-06-16 01:31:19 +00:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
5aaaf3c599
|
|||
|
de8d0dba1d
|
|||
|
b51ea576a3
|
|||
|
a1c81c7120
|
|||
|
2f78fd46ef
|
|||
|
ecd0363c45
|
@@ -117,8 +117,58 @@ jobs:
|
||||
with:
|
||||
args: ./...
|
||||
|
||||
build-docker:
|
||||
|
||||
build-binary:
|
||||
needs: [ prepare, test, code_scans ]
|
||||
name: Binary compilation and release
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
- name: Install Go
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
- name: Build binaries
|
||||
run: |
|
||||
LOCAL_VERSION=${{ needs.prepare.outputs.RELEASE_VERSION }} make dist-release
|
||||
|
||||
- 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 release [semver]
|
||||
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' }}
|
||||
artifacts: "dist/*"
|
||||
allowUpdates: true
|
||||
|
||||
- name: Delete existing v1 tag and release
|
||||
run: |
|
||||
gh release delete v1 --cleanup-tag -y
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GHCR_TOKEN }}
|
||||
|
||||
- name: Create release [v1]
|
||||
uses: ncipollo/release-action@v1
|
||||
with:
|
||||
bodyFile: ./.release_notes
|
||||
name: v1 - ${{ needs.prepare.outputs.RELEASE_VERSION }}
|
||||
token: ${{ secrets.GHCR_TOKEN }}
|
||||
tag: v1
|
||||
prerelease: ${{ github.ref != 'refs/heads/master' && github.ref != 'refs/heads/main' }}
|
||||
artifacts: "dist/*"
|
||||
allowUpdates: true
|
||||
makeLatest: false
|
||||
|
||||
build-docker:
|
||||
needs: [ prepare, test, code_scans, build-binary ]
|
||||
name: Docker image build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
@@ -139,9 +189,9 @@ jobs:
|
||||
id: prep
|
||||
run: |
|
||||
if [ -z "${{ needs.prepare.outputs.RELEASE_VERSION }}" ]; then
|
||||
TAGS="${{ needs.prepare.outputs.DOCKER_IMAGE }}:${{ needs.prepare.outputs.GITHUB_SHA }},${{ needs.prepare.outputs.DOCKER_IMAGE }}:latest"
|
||||
TAGS="${{ needs.prepare.outputs.DOCKER_IMAGE }}:${{ needs.prepare.outputs.GITHUB_SHA }},${{ needs.prepare.outputs.DOCKER_IMAGE }}:latest,${{ needs.prepare.outputs.DOCKER_IMAGE }}:v1"
|
||||
else
|
||||
TAGS="${{ needs.prepare.outputs.DOCKER_IMAGE }}:${{ needs.prepare.outputs.GITHUB_SHA }},${{ needs.prepare.outputs.DOCKER_IMAGE }}:${{ needs.prepare.outputs.RELEASE_VERSION }},${{ needs.prepare.outputs.DOCKER_IMAGE }}:latest"
|
||||
TAGS="${{ needs.prepare.outputs.DOCKER_IMAGE }}:${{ needs.prepare.outputs.GITHUB_SHA }},${{ needs.prepare.outputs.DOCKER_IMAGE }}:${{ needs.prepare.outputs.RELEASE_VERSION }},${{ needs.prepare.outputs.DOCKER_IMAGE }}:latest,${{ needs.prepare.outputs.DOCKER_IMAGE }}:v1"
|
||||
fi
|
||||
echo "TAGS=$TAGS" >> $GITHUB_OUTPUT
|
||||
BRANCH=$(echo ${GITHUB_REF##*/} | tr '[A-Z]' '[a-z]')
|
||||
@@ -169,95 +219,3 @@ jobs:
|
||||
${{ steps.prep.outputs.args }}
|
||||
labels: ${{ steps.prep.outputs.labels }}
|
||||
no-cache: false
|
||||
# - name: Scan image
|
||||
# uses: anchore/scan-action@v2
|
||||
# if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' }}
|
||||
# with:
|
||||
# image: "${{ needs.prepare.outputs.DOCKER_IMAGE }}:${{ needs.prepare.outputs.GITHUB_SHA }}"
|
||||
# fail-build: false
|
||||
|
||||
build-binary:
|
||||
needs: [ prepare, test, code_scans ]
|
||||
name: Binary compilation and release
|
||||
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:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
- name: Install Go
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
- name: Build binaries
|
||||
run: |
|
||||
LOCAL_VERSION=${{ needs.prepare.outputs.RELEASE_VERSION }} make dist-release
|
||||
|
||||
- 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 release [semver]
|
||||
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' }}
|
||||
artifacts: "dist/*"
|
||||
allowUpdates: true
|
||||
|
||||
- name: Create release [v1]
|
||||
uses: ncipollo/release-action@v1
|
||||
with:
|
||||
bodyFile: ./.release_notes
|
||||
name: version ${{ needs.prepare.outputs.RELEASE_VERSION }}
|
||||
token: ${{ secrets.GHCR_TOKEN }}
|
||||
tag: v1
|
||||
prerelease: ${{ github.ref != 'refs/heads/master' && github.ref != 'refs/heads/main' }}
|
||||
artifacts: "dist/*"
|
||||
allowUpdates: true
|
||||
|
||||
# - name: Compile and release semver
|
||||
# uses: wangyoucao577/go-release-action@v1.34
|
||||
# with:
|
||||
# github_token: ${{ secrets.GHCR_TOKEN }}
|
||||
# goos: ${{ matrix.goos }}
|
||||
# goarch: ${{ matrix.goarch }}
|
||||
# ldflags: -s -w -X main.PKG_VERSION=${{ needs.prepare.outputs.RELEASE_VERSION }}
|
||||
# project_path: .
|
||||
# binary_name: semver-gen
|
||||
# asset_name: semver-gen-${{ matrix.goos }}-${{ matrix.goarch }}
|
||||
# release_name: version ${{ needs.prepare.outputs.RELEASE_VERSION }}
|
||||
# release_tag: ${{ needs.prepare.outputs.RELEASE_VERSION }}
|
||||
# compress_assets: false
|
||||
# retry: 10
|
||||
# overwrite: true
|
||||
# pre_command: export GODEBUG=http2client=0 && export CGO_ENABLED=1 && make update
|
||||
|
||||
# - name: Compile and release v1
|
||||
# uses: wangyoucao577/go-release-action@v1.33
|
||||
# with:
|
||||
# github_token: ${{ secrets.GHCR_TOKEN }}
|
||||
# goos: ${{ matrix.goos }}
|
||||
# goarch: ${{ matrix.goarch }}
|
||||
# ldflags: -s -w -X main.PKG_VERSION=${{ needs.prepare.outputs.RELEASE_VERSION }}
|
||||
# project_path: .
|
||||
# binary_name: semver-gen
|
||||
# asset_name: semver-gen-${{ matrix.goos }}-${{ matrix.goarch }}
|
||||
# release_name: version v1
|
||||
# release_tag: v1
|
||||
# compress_assets: false
|
||||
# retry: 10
|
||||
# overwrite: true
|
||||
# pre_command: export GODEBUG=http2client=0 && export CGO_ENABLED=1 && make update
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
#!/bin/sh -l
|
||||
set -o pipefail
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
FLAGS=""
|
||||
|
||||
@@ -37,5 +37,5 @@ fi
|
||||
cd /github/workspace
|
||||
OUT_SEMVER_GEN=$(/go/src/app/semver-gen generate $FLAGS $*)
|
||||
[ $? -eq 0 ] || exit 1
|
||||
echo "::set-output name=semantic_version::$(echo $OUT_SEMVER_GEN | sed -e 's|SEMVER ||g')"
|
||||
echo "semantic_version=$(echo $OUT_SEMVER_GEN | sed -e 's|SEMVER ||g') >> $GITHUB_OUTPUT"
|
||||
echo $OUT_SEMVER_GEN
|
||||
Reference in New Issue
Block a user