forked from jozu-ai/kitops
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Splits the release builds to corresponding platforms. Introduces go-releaser configuration for each platform. adds a new workflow that uses gh CLI to do the publish.
- Loading branch information
Showing
6 changed files
with
289 additions
and
168 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
name: Release with Platform builds | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
skip_signing: | ||
description: 'Skip code signing' | ||
required: true | ||
default: false | ||
type: boolean | ||
push: | ||
tags: | ||
- 'v*' | ||
|
||
permissions: | ||
contents: write | ||
jobs: | ||
build-macos: | ||
runs-on: macos-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: 'go.mod' | ||
|
||
# - name: Import Apple Code Signing Certificates | ||
# if: ${{ github.event_name != 'workflow_dispatch' || !inputs.skip_signing }} | ||
# uses: Apple-Actions/import-codesign-certs@v2 | ||
# with: | ||
# p12-file-base64: ${{ secrets.APPLE_CERTIFICATE_BASE64 }} | ||
# p12-password: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }} | ||
|
||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v5 | ||
with: | ||
version: latest | ||
distribution: goreleaser | ||
args: release --clean --snapshot --config ./.goreleaser.darwin.yaml | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
APPLE_DEVELOPER_ID: ${{ secrets.APPLICATION_IDENTITY}} | ||
APPLE_ID: ${{ vars.APPLE_ID }} | ||
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD}} | ||
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID}} | ||
- name: Notarize the macOS binary | ||
run: | | ||
./build/scripts/sign ./dist/kitops-darwin-amd64.zip | ||
./build/scripts/sign ./dist/kitops-darwin-x86_64.zip | ||
- name: Upload macOS artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: dist-macos | ||
if-no-files-found: error | ||
retention-days: 7 | ||
path: | | ||
./dist/*.zip | ||
build-windows: | ||
runs-on: windows-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: 'go.mod' | ||
|
||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v5 | ||
with: | ||
version: latest | ||
distribution: goreleaser | ||
args: release --clean --snapshot --config ./.goreleaser.windows.yaml | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Upload Windows artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: dist-windows | ||
if-no-files-found: error | ||
retention-days: 7 | ||
path: | | ||
./dist/*.zip | ||
build-linux: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: 'go.mod' | ||
|
||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v5 | ||
with: | ||
version: latest | ||
distribution: goreleaser | ||
args: release --clean --snapshot --config ./.goreleaser.linux.yaml | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Upload Linux artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: dist-linux | ||
if-no-files-found: error | ||
retention-days: 7 | ||
path: | | ||
./dist/*.tar.gz | ||
release: | ||
runs-on: ubuntu-latest | ||
needs: [build-linux, build-macos, build-windows] | ||
steps: | ||
- name: Merge built artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
path: dist | ||
pattern: dist-* | ||
merge-multiple: true | ||
- name: Create Checksums | ||
env: | ||
TAG_NAME: ${{ github.ref_name}} | ||
run: | | ||
shopt -s failglob | ||
pushd dist | ||
shasum -a 256 kitops-* > checksums.txt | ||
mv checksums.txt kitops_${TAG_NAME}_checksums.txt | ||
popd | ||
- name: Create Release | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
TAG_NAME: ${{ github.ref_name}} | ||
REPO: ${{ github.repository }} | ||
run: | | ||
echo "Creating release for ${TAG_NAME}" | ||
release_args=( | ||
${TAG_NAME} | ||
./dist/*.* | ||
--title "Release ${TAG_NAME}" | ||
--generate-notes | ||
--repo ${REPO} | ||
) | ||
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then | ||
previous_release="$(gh release list --repo $REPO --limit 1 --json tagName --jq '.[] | .tagName ')" | ||
echo "Previous release: ${previous_release}" | ||
release_args+=("--latest") | ||
release_args+=("--verify-tag") | ||
release_args+=("--notes-start-tag ${previous_release}") | ||
fi | ||
gh release create "${release_args[@]}" | ||
- name: Generate CLI documentation | ||
run: | | ||
./docs/src/docs/cli/generate.sh > /dev/null | ||
- name: PR for CLI documentation | ||
uses: peter-evans/create-pull-request@v6 | ||
with: | ||
add-paths: | | ||
docs/*.md | ||
commit-message: "docs: update CLI documentation for ${{ github.ref_name }}" |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
|
||
version: 1 | ||
|
||
project_name: kitops | ||
|
||
before: | ||
hooks: | ||
- go mod tidy | ||
|
||
builds: | ||
- id: "kit-macos" | ||
env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- darwin | ||
goarch: | ||
- amd64 | ||
- arm64 | ||
binary: kit | ||
ldflags: | ||
- -s -w -X kitops/pkg/cmd/version.Version={{.Version}} -X kitops/pkg/cmd/version.GitCommit={{.Commit}} -X kitops/pkg/cmd/version.BuildTime={{.CommitDate}} | ||
hooks: | ||
post: | ||
- cmd: ./build/scripts/sign '{{ .Path }}' | ||
output: true | ||
|
||
archives: | ||
- id: kit-macos-archive | ||
format: zip | ||
builds: | ||
- kit-macos | ||
name_template: >- | ||
{{ .ProjectName }}- | ||
{{- tolower .Os }}- | ||
{{- if eq .Arch "amd64" }}x86_64 | ||
{{- else if eq .Arch "386" }}i386 | ||
{{- else }}{{ .Arch }}{{ end }} | ||
{{- if .Arm }}v{{ .Arm }}{{ end }} | ||
wrap_in_directory: true | ||
rlcp: true | ||
files: | ||
- LICENSE | ||
- README.md | ||
|
||
git: | ||
ignore_tags: | ||
- "next" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
|
||
version: 1 | ||
|
||
project_name: kitops | ||
|
||
before: | ||
hooks: | ||
- go mod tidy | ||
|
||
builds: | ||
- id: "kit-linux" | ||
env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- linux | ||
binary: kit | ||
ldflags: | ||
- -s -w -X kitops/pkg/cmd/version.Version={{.Version}} -X kitops/pkg/cmd/version.GitCommit={{.Commit}} -X kitops/pkg/cmd/version.BuildTime={{.CommitDate}} | ||
|
||
archives: | ||
- id: kit-archive | ||
format: tar.gz | ||
builds: | ||
- kit-linux | ||
name_template: >- | ||
{{ .ProjectName }}- | ||
{{- tolower .Os }}- | ||
{{- if eq .Arch "amd64" }}x86_64 | ||
{{- else if eq .Arch "386" }}i386 | ||
{{- else }}{{ .Arch }}{{ end }} | ||
{{- if .Arm }}v{{ .Arm }}{{ end }} | ||
rlcp: true | ||
files: | ||
- LICENSE | ||
- README.md | ||
|
||
git: | ||
ignore_tags: | ||
- "next" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
|
||
version: 1 | ||
|
||
project_name: kitops | ||
|
||
before: | ||
hooks: | ||
- go mod tidy | ||
|
||
builds: | ||
- id: "kit-wins" | ||
env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- windows | ||
binary: kit | ||
ldflags: | ||
- -s -w -X kitops/pkg/cmd/version.Version={{.Version}} -X kitops/pkg/cmd/version.GitCommit={{.Commit}} -X kitops/pkg/cmd/version.BuildTime={{.CommitDate}} | ||
|
||
archives: | ||
- id: kit-archive | ||
format: zip | ||
builds: | ||
- kit-wins | ||
name_template: >- | ||
{{ .ProjectName }}- | ||
{{- tolower .Os }}- | ||
{{- if eq .Arch "amd64" }}x86_64 | ||
{{- else if eq .Arch "386" }}i386 | ||
{{- else }}{{ .Arch }}{{ end }} | ||
{{- if .Arm }}v{{ .Arm }}{{ end }} | ||
rlcp: true | ||
files: | ||
- LICENSE | ||
- README.md | ||
|
||
|
Oops, something went wrong.