File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1313 - ' stl-preview-base/**'
1414
1515jobs :
16+ build :
17+ timeout-minutes : 10
18+ name : build
19+ permissions :
20+ contents : read
21+ id-token : write
22+ runs-on : ${{ github.repository == 'stainless-sdks/hypeman-go' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
23+ if : |-
24+ github.repository == 'stainless-sdks/hypeman-go' &&
25+ (github.event_name == 'push' || github.event.pull_request.head.repo.fork)
26+ steps :
27+ - uses : actions/checkout@v6
28+
29+ - name : Get GitHub OIDC Token
30+ if : github.repository == 'stainless-sdks/hypeman-go'
31+ id : github-oidc
32+ uses : actions/github-script@v8
33+ with :
34+ script : core.setOutput('github_token', await core.getIDToken());
35+
36+ - name : Upload tarball
37+ if : github.repository == 'stainless-sdks/hypeman-go'
38+ env :
39+ URL : https://pkg.stainless.com/s
40+ AUTH : ${{ steps.github-oidc.outputs.github_token }}
41+ SHA : ${{ github.sha }}
42+ run : ./scripts/utils/upload-artifact.sh
1643 lint :
1744 timeout-minutes : 10
1845 name : lint
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ set -exuo pipefail
3+
4+ DIST_DIR=" dist"
5+ FILENAME=" source.zip"
6+
7+ mapfile -d ' ' files < <(
8+ find . -type f \
9+ \( -name ' *.go' -o -name ' go.mod' -o -name ' go.sum' \) \
10+ ! -path " ./${DIST_DIR} /*" \
11+ -print0
12+ )
13+
14+ if [[ ${# files[@]} -eq 0 ]]; then
15+ echo -e " \033[31mNo Go source files found for packaging.\033[0m"
16+ exit 1
17+ fi
18+
19+ mkdir -p " $DIST_DIR "
20+ rm -f " ${DIST_DIR} /${FILENAME} "
21+
22+ relative_files=()
23+ for file in " ${files[@]} " ; do
24+ relative_files+=(" ${file# ./ } " )
25+ done
26+
27+ zip " ${DIST_DIR} /${FILENAME} " " ${relative_files[@]} "
28+
29+ RESPONSE=$( curl -X POST " $URL ?filename=$FILENAME " \
30+ -H " Authorization: Bearer $AUTH " \
31+ -H " Content-Type: application/json" )
32+
33+ SIGNED_URL=$( echo " $RESPONSE " | jq -r ' .url' )
34+
35+ if [[ " $SIGNED_URL " == " null" ]]; then
36+ echo -e " \033[31mFailed to get signed URL.\033[0m"
37+ exit 1
38+ fi
39+
40+ UPLOAD_RESPONSE=$( curl -v -X PUT \
41+ -H " Content-Type: application/zip" \
42+ --data-binary " @${DIST_DIR} /${FILENAME} " " $SIGNED_URL " 2>&1 )
43+
44+ if echo " $UPLOAD_RESPONSE " | grep -q " HTTP/[0-9.]* 200" ; then
45+ echo -e " \033[32mUploaded build to Stainless storage.\033[0m"
46+ echo -e " \033[32mInstallation: Download and unzip: 'https://pkg.stainless.com/s/hypeman-go/$SHA '. Run 'go mod edit -replace github.com/kernel/hypeman-go=/path/to/unzipped_directory'.\033[0m"
47+ else
48+ echo -e " \033[31mFailed to upload artifact.\033[0m"
49+ exit 1
50+ fi
You can’t perform that action at this time.
0 commit comments