This commit is contained in:
1 parent
6ff0b5c96c
commit
b05ef16265
1 file changed
+41
@@ -0,0 +1,41 @@
|
|||||||
|
name: Publish userscripts
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
paths:
|
||||||
|
- 'src/**'
|
||||||
|
- '.gitea/workflows/**'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publish:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Build dist
|
||||||
|
run: |
|
||||||
|
VERSION=$(TZ=AEST-10 date +%Y.%m.%d.%H%M)
|
||||||
|
BASE=https://code.home-brightview.com/matt.rb/dynamics-userscripts/raw/branch/dist
|
||||||
|
mkdir -p dist
|
||||||
|
for f in src/*.user.js; do
|
||||||
|
n=$(basename "$f" .user.js)
|
||||||
|
sed -e "s|^// @version .*|// @version $VERSION|" \
|
||||||
|
-e "s|^// ==/UserScript==|// @updateURL $BASE/$n.meta.js\n// @downloadURL $BASE/$n.user.js\n// ==/UserScript==|" \
|
||||||
|
"$f" > "dist/$n.user.js"
|
||||||
|
sed -n '1,/==\/UserScript==/p' "dist/$n.user.js" > "dist/$n.meta.js"
|
||||||
|
echo "Built $n $VERSION"
|
||||||
|
done
|
||||||
|
echo "VERSION=$VERSION" >> "$GITHUB_ENV"
|
||||||
|
|
||||||
|
- name: Force-push dist branch
|
||||||
|
env:
|
||||||
|
TOKEN: ${{ secrets.PUBLISH_TOKEN }}
|
||||||
|
run: |
|
||||||
|
cd dist
|
||||||
|
git init -b dist
|
||||||
|
git config user.name "gitea-actions"
|
||||||
|
git config user.email "actions@home-brightview.com"
|
||||||
|
git add .
|
||||||
|
git commit -m "Publish $VERSION"
|
||||||
|
git push -f "https://matt.rb:${TOKEN}@git.home-brightview.com/${{ github.repository }}.git" dist
|
||||||
Reference in new issue
Block a user