-
Notifications
You must be signed in to change notification settings - Fork 0
33 lines (33 loc) · 1.15 KB
/
ci.yml
File metadata and controls
33 lines (33 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
name: CI
permissions:
contents: write
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: make test
- run: strip html2json && upx -9 html2json
- name: tag and publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_FILES: html2json
run: |
RELEASE_TAG="$(date +%y%m%d)"
curl -s -XPOST -d '{"tag_name": "'$RELEASE_TAG'"}' \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-H 'Content-Type: application/json' \
"https://api.github.com/repos/${GITHUB_REPOSITORY}/releases" || :
RELEASE_ID=$(curl -s https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/tags/$RELEASE_TAG | jq .id)
echo tag=$RELEASE_TAG has id=$RELEASE_ID
for RELEASE_FILE in $RELEASE_FILES; do
curl -s -XPOST -T $RELEASE_FILE \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Content-Type:application/octet-stream" \
"https://uploads.github.com/repos/${GITHUB_REPOSITORY}/releases/$RELEASE_ID/assets?name=$RELEASE_FILE" || :
done