Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions .github/workflows/go-build-release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Go Build and Release with GoReleaser
name: GoReleaser
run-name: GoReleaser ${{ (inputs.snapshot == 'true' || (inputs.snapshot != 'false' && !startsWith(github.ref, 'refs/tags/v'))) && 'Snapshot' || 'Release' }}

on:
workflow_call:
Expand Down Expand Up @@ -61,7 +62,8 @@
permissions: write-all # Necessary for the generate-build-provenance action with containers

jobs:
build_and_release:
goreleaser:
name: GoReleaser ${{ (inputs.snapshot == 'true' || (inputs.snapshot != 'false' && !startsWith(github.ref, 'refs/tags/v'))) && 'Snapshot' || 'Release' }}
runs-on: ubuntu-latest
steps:
- name: Set up Go
Expand All @@ -86,7 +88,7 @@
fetch-depth: ${{ inputs.fetch-depth }}

- name: Set build environment variables
run: |

Check failure on line 91 in .github/workflows/go-build-release.yml

View workflow job for this annotation

GitHub Actions / lint

shellcheck reported issue in this script: SC2086:info:4:32: Double quote to prevent globbing and word splitting

Check failure on line 91 in .github/workflows/go-build-release.yml

View workflow job for this annotation

GitHub Actions / lint

shellcheck reported issue in this script: SC2086:info:3:55: Double quote to prevent globbing and word splitting

Check failure on line 91 in .github/workflows/go-build-release.yml

View workflow job for this annotation

GitHub Actions / lint

shellcheck reported issue in this script: SC2086:info:2:34: Double quote to prevent globbing and word splitting

Check failure on line 91 in .github/workflows/go-build-release.yml

View workflow job for this annotation

GitHub Actions / lint

shellcheck reported issue in this script: SC2086:info:1:100: Double quote to prevent globbing and word splitting

Check failure on line 91 in .github/workflows/go-build-release.yml

View workflow job for this annotation

GitHub Actions / lint

shellcheck reported issue in this script: SC2129:style:1:1: Consider using { cmd1; cmd2; } >> file instead of individual redirects
echo "GIT_STATE=$(if git diff-index --quiet HEAD --; then echo 'clean'; else echo 'dirty'; fi)" >> $GITHUB_ENV
echo "BUILD_HOST=$(hostname)" >> $GITHUB_ENV
echo "GO_VERSION=$(go version | awk '{print $3}')" >> $GITHUB_ENV
Expand All @@ -94,7 +96,7 @@

- name: Set CGO_ENABLED if specified
if: ${{ inputs.cgo-enabled != '' }}
run: echo "CGO_ENABLED=${{ inputs.cgo-enabled }}" >> $GITHUB_ENV

Check failure on line 99 in .github/workflows/go-build-release.yml

View workflow job for this annotation

GitHub Actions / lint

shellcheck reported issue in this script: SC2086:info:1:49: Double quote to prevent globbing and word splitting

- name: Set additional environment variables
if: ${{ inputs.additional-env-vars != '' }}
Expand Down Expand Up @@ -126,14 +128,14 @@
fi
fi

- name: Release with GoReleaser
- name: GoReleaser ${{ inputs.goreleaser-args }} ${{ steps.snapshot_flags.outputs.flags }}
id: goreleaser
uses: goreleaser/goreleaser-action@v6
env:
GITHUB_TOKEN: ${{ github.token }}
with:
version: ${{ inputs.goreleaser-version }}
args: ${{ inputs.goreleaser-args }} ${{ steps.snapshot_flags.outputs.flags }}
id: goreleaser

- name: Process GoReleaser output
id: process_goreleaser_output
Expand Down
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Use major version tags for stability:
# For reusable workflows
jobs:
release:
uses: OpenCHAMI/github-actions/.github/workflows/go-build-release.yml@v3.2
uses: OpenCHAMI/github-actions/.github/workflows/go-build-release.yml@v3.3
```

Pin a commit SHA internally for maximum supply‑chain safety if desired.
Expand All @@ -38,7 +38,8 @@ Standardized GoReleaser workflow for building and releasing Go applications with

**Usage:**
```yaml
name: Release with goreleaser
name: GoReleaser
run-name: GoReleaser ${{ startsWith(github.ref, 'refs/tags/v') && 'Release' || 'Snapshot' }}

on:
workflow_dispatch:
Expand All @@ -48,8 +49,9 @@ on:
- v*

jobs:
release:
uses: OpenCHAMI/github-actions/.github/workflows/go-build-release.yml@v3.2
goreleaser:
name: GoReleaser ${{ startsWith(github.ref, 'refs/tags/v') && 'Release' || 'Snapshot' }}
uses: OpenCHAMI/github-actions/.github/workflows/go-build-release.yml@v3.3
with:
pre-build-commands: |
go install github.com/swaggo/swag/cmd/swag@latest
Expand Down
Loading