setup-browser/.forgejo/workflows/build.yaml

51 lines
1.6 KiB
YAML
Raw Normal View History

2024-12-25 04:33:01 +01:00
on:
push:
branches:
- main
2024-12-26 21:56:12 +01:00
paths:
- 'src/*.v'
2024-12-25 04:33:01 +01:00
jobs:
build:
name: Build and upload binary
runs-on: docker
steps:
- uses: actions/checkout@v4
- name: Install v
run: |
wget -q https://github.com/vlang/v/releases/latest/download/v_linux.zip
pushd /tmp
unzip -q $GITHUB_WORKSPACE/v_linux.zip
popd
rm v_linux.zip
/tmp/v/v version
- name: Build setup-browser
run: |
/tmp/v/v -prod .
- name: Upload binary as generic package and create a release
run: |
2024-12-26 21:56:12 +01:00
set -e
VERSION="$(date +'%y.%m.%d').$(git rev-parse --short HEAD)"
echo Download jq
wget -q https://github.com/jqlang/jq/releases/latest/download/jq-linux-amd64 -O jq
chmod +x jq
2024-12-25 04:33:01 +01:00
2024-12-26 21:56:12 +01:00
echo Create a tag
git tag "$VERSION"
git push --tags
2024-12-25 04:33:01 +01:00
2024-12-26 21:56:12 +01:00
echo Create a release
OUT=$(curl --silent -X POST -H "Authorization: token $GITHUB_TOKEN" \
-H "Content-Type: application/json" \
--data '{"name": "'$VERSION'", "tag_name": "'$VERSION'"}' \
"$GITHUB_API_URL/repos/actions/setup-browser/releases" \
| tee /dev/stderr)
2024-12-25 04:33:01 +01:00
2024-12-26 21:56:12 +01:00
UP_URL=$(echo "$OUT" | ./jq -r .upload_url )
2024-12-25 04:33:01 +01:00
2024-12-26 21:56:12 +01:00
echo Add the binary to the release
curl --silent -X 'POST' --header "Authorization: token $GITHUB_TOKEN" \
"$UP_URL" \
-H 'accept: application/json' \
-H 'Content-Type: multipart/form-data' \
-F 'attachment=@setup-browser'