Adding actions
This commit is contained in:
parent
e1375565e0
commit
6cdf7adebe
70
.gitea/workflows/build.yaml
Normal file
70
.gitea/workflows/build.yaml
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
name: go-builder
|
||||||
|
run-name: go-builder
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- release/*
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: gobuilder
|
||||||
|
container:
|
||||||
|
image: gobuilder:0.0.5
|
||||||
|
steps:
|
||||||
|
- name: Clone
|
||||||
|
run: |
|
||||||
|
mkdir -p ~/.ssh
|
||||||
|
echo "${{ secrets.PI_GIT_KEY }}" | tr -d '\r' > ~/.ssh/id_ed25519
|
||||||
|
chmod 600 ~/.ssh/id_ed25519
|
||||||
|
ssh-keyscan git.kcrawford.net >> ~/.ssh/known_hosts
|
||||||
|
git clone --branch ${GITHUB_REF_NAME} git@git.kcrawford.net:${{env.GITHUB_REPOSITORY}}.git .
|
||||||
|
|
||||||
|
- name: Inspect
|
||||||
|
run: |
|
||||||
|
env
|
||||||
|
#while true; do sleep 180; done
|
||||||
|
|
||||||
|
- name: Create Release
|
||||||
|
id: release_num
|
||||||
|
run: |
|
||||||
|
TAG_NAME=$(basename ${GITHUB_REF_NAME})
|
||||||
|
MESSAGE=$(echo ${{ github.event.head_commit.message }})
|
||||||
|
|
||||||
|
curl -sH "Content-Type: application/json" \
|
||||||
|
-H "Authorization: token ${{secrets.REPO_API_RW_TOKEN}}" \
|
||||||
|
-X POST ${{env.GITHUB_API_URL}}/repos/${{env.GITHUB_REPOSITORY}}/releases \
|
||||||
|
-d '{"body": "Complied Binary Files", "draft": false, "name": "'"${MESSAGE}"'", "prerelease": false, "tag_name": "'"${TAG_NAME}"'" }' \
|
||||||
|
--output site.output --write-out %{http_code} > http.response.code 2> error.messages
|
||||||
|
|
||||||
|
if grep -q 201 http.response.code; then
|
||||||
|
id=$(jq '.id' < site.output)
|
||||||
|
echo "release_num=${id}" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
jq < site.output
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Build and upload
|
||||||
|
id: upload
|
||||||
|
needs: release_num
|
||||||
|
env:
|
||||||
|
ID: ${{steps.release_num.outputs.release_num}}
|
||||||
|
run: |
|
||||||
|
repo=$(basename ${{env.GITHUB_REPOSITORY}})
|
||||||
|
go mod download
|
||||||
|
for os in linux darwin
|
||||||
|
do
|
||||||
|
for arch in arm64 amd64
|
||||||
|
do
|
||||||
|
# Build
|
||||||
|
filename=${repo}_${os}_${arch}
|
||||||
|
echo "Building for" $filename
|
||||||
|
env CGO_ENABLED=0 GOOS=${os} GOARCH=${arch} go build -o ${filename}
|
||||||
|
|
||||||
|
# Upload
|
||||||
|
curl -vH 'accept: application/json' \
|
||||||
|
-H "Content-Type: multipart/form-data" \
|
||||||
|
-H "Authorization: token ${{secrets.REPO_API_RW_TOKEN}}" \
|
||||||
|
-X POST ${{env.GITHUB_API_URL}}/repos/${{env.GITHUB_REPOSITORY}}/releases/$ID/assets?name=$filename -F attachment=@"${filename}"
|
||||||
|
done
|
||||||
|
done
|
@ -16,7 +16,7 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: http-header
|
- name: http-header
|
||||||
image: git.10bit.link/kcrawford/golang-http-header:0.0.4
|
image: git.kcrawford.net/kcrawford/golang-http-header:0.0.4
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 8000
|
- containerPort: 8000
|
||||||
|
|
||||||
@ -31,4 +31,4 @@ spec:
|
|||||||
ports:
|
ports:
|
||||||
- protocol: TCP
|
- protocol: TCP
|
||||||
port: 80
|
port: 80
|
||||||
targetPort: 8000
|
targetPort: 8000
|
||||||
|
Loading…
Reference in New Issue
Block a user