Skip to content

Fix builds for binary download in GPTScript (#4) #56

Fix builds for binary download in GPTScript (#4)

Fix builds for binary download in GPTScript (#4) #56

Workflow file for this run

name: build
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
workflow_dispatch:
push:
branches:
- 'master'
tags:
- 'v*'
pull_request:
env:
DESTDIR: ./bin
GO_VERSION: 1.21.10
jobs:
validate:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
target:
- lint
- validate-vendor
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Run
run: |
make ${{ matrix.target }}
build:
runs-on: ubuntu-22.04
steps:
-
name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Build
run: |
make release
env:
CACHE_FROM: type=gha,scope=build
CACHE_TO: type=gha,scope=build,mode=max
-
name: List artifacts
run: |
tree -nh ${{ env.DESTDIR }}
-
name: Check artifacts
run: |
find ${{ env.DESTDIR }} -type f -exec file -e ascii -e text -- {} +
-
name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: gptscript-credential-helpers
path: ${{ env.DESTDIR }}/*
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-wincred
mv ${{ env.DESTDIR }}/gptscript-credential-wincred ${{ env.DESTDIR }}/gptscript-credential-wincred.exe
- name: Upload Windows Artifact
uses: actions/upload-artifact@v4
with:
name: gptscript-credential-helpers-windows
path: ${{ env.DESTDIR }}/*wincred*
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: |
pushd ./gptscript-credential-helpers-windows
sha256sum -b gptscript-credential-wincred.exe >> ../gptscript-credential-helpers/checksums.txt
popd
- name: Create Release
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifactErrorsFailBuild: true
artifacts: "./gptscript-credential-helpers/*,./gptscript-credential-helpers-windows/*"
makeLatest: ${{ !contains(github.ref_name, '-rc') }}
generateReleaseNotes: true
prerelease: ${{ contains(github.ref_name, '-rc') }}
replacesArtifacts: true
token: ${{ secrets.GITHUB_TOKEN }}