-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Grant Linville <[email protected]>
- Loading branch information
1 parent
5e7c22b
commit d4edbac
Showing
2 changed files
with
107 additions
and
1 deletion.
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,81 @@ | ||
name: build | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- 'main' | ||
tags: | ||
- 'v*' | ||
pull_request: | ||
|
||
env: | ||
DESTDIR: ./bin | ||
GO_VERSION: 1.23.1 | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Build | ||
run: | | ||
make build | ||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: credential | ||
path: credential-* | ||
if-no-files-found: error | ||
|
||
windows_build: | ||
runs-on: windows-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
- name: Build | ||
run: | | ||
make build-windows | ||
- name: Upload Windows Artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: credential-windows | ||
path: credential-*.exe | ||
if-no-files-found: error | ||
|
||
create_release: | ||
runs-on: ubuntu-latest | ||
needs: [ build, windows_build ] | ||
if: startsWith(github.ref, 'refs/tags/v') | ||
steps: | ||
- run: sleep 10 | ||
- name: Download all artifacts | ||
uses: actions/download-artifact@v4 | ||
- run: ls -lR | ||
- run: | | ||
sha256sum -b credential*/* > checksums.txt | ||
sha256sum -c --strict checksums.txt | ||
- name: Create Release | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
allowUpdates: true | ||
artifactErrorsFailBuild: true | ||
artifacts: "./credential/*,./credential-windows/*,./checksums.txt" | ||
makeLatest: ${{ !contains(github.ref_name, '-rc') }} | ||
generateReleaseNotes: true | ||
prerelease: ${{ contains(github.ref_name, '-rc') }} | ||
replacesArtifacts: true | ||
token: ${{ secrets.GITHUB_TOKEN }} |
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 |
---|---|---|
@@ -1,2 +1,27 @@ | ||
VERSION=$(shell git describe --tags --always --dirty) | ||
|
||
# Build target for darwin and linux for both amd64 and arm64 | ||
build: | ||
CGO_ENABLED=0 go build -o bin/gptscript-go-tool -ldflags "-s -w" | ||
@echo "Building for darwin and linux..." | ||
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags "-s -w" -o credential-darwin-amd64 ./... | ||
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags "-s -w" -o credential-darwin-arm64 ./... | ||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w" -o credential-linux-amd64 ./... | ||
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags "-s -w" -o credential-linux-arm64 ./... | ||
|
||
# Build target for windows for both amd64 and arm64 | ||
build-windows: | ||
@echo "Building for windows..." | ||
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags "-s -w" -o credential-windows-amd64.exe ./... | ||
CGO_ENABLED=0 GOOS=windows GOARCH=arm64 go build -ldflags "-s -w" -o credential-windows-arm64.exe ./... | ||
|
||
# Clean up binaries | ||
clean: | ||
@echo "Cleaning up..." | ||
rm -f credential-darwin-amd64 | ||
rm -f credential-darwin-arm64 | ||
rm -f credential-linux-amd64 | ||
rm -f credential-linux-arm64 | ||
rm -f credential-windows-amd64.exe | ||
rm -f credential-windows-arm64.exe | ||
|
||
.PHONY: build build-windows clean |