reitanlage-oranienburg/.forgejo/workflows/release.yaml
Tobias Reisinger 18cc04f5df
All checks were successful
/ build-artifacts (push) Successful in 1m4s
/ deploy (push) Successful in 2s
Add deploy workflow
2025-05-21 00:13:53 +02:00

48 lines
1.6 KiB
YAML

on:
push:
tags:
- v**
jobs:
build-artifacts:
runs-on: docker
steps:
- uses: https://code.forgejo.org/actions/checkout@v3
- id: build
run: |
echo "@fontawesome:registry=https://git.serguzim.me/api/packages/fontawesome/npm/" > .npmrc
echo "//git.serguzim.me/api/packages/fontawesome/npm/:_authToken=${{ secrets.FORGEJO_TOKEN }}" >> .npmrc
mkdir /tmp/release-dir
npm install
npm run production
git add -f dist/
git stash
git config --global --add safe.directory ${{ github.workspace }}
git archive --format=zip 'stash@{0}' -o /tmp/release-dir/reitanlage-oranienburg-${{ github.ref_name }}.zip --prefix=reitanlage-oranienburg/
shell: bash
- uses: https://code.forgejo.org/actions/forgejo-release@v1
with:
direction: upload
release-dir: /tmp/release-dir
token: ${{ github.token }}
deploy:
runs-on: docker
needs: build-artifacts
steps:
- name: Prepare deploy script
run: |
cat <<EOF > script.sh
cd /var/www/html
bin/gpm direct-install -y \
"https://git.serguzim.me/serguzim/reitanlage-oranienburg/releases/download/${{ github.ref_name }}/reitanlage-oranienburg-${{ github.ref_name }}.zip"
- id: deploy
run: |
curl -vLX POST \
-H "Content-Type: application/json" \
-H "X-Webhook-Token: ${{ secrets.DEPLOY_WEBHOOK_TOKEN }}" \
-d "{\"data\": \"$(base64 -w0 script.sh)\"}" \
https://deploy.serguzim.me/hooks/deploy-reitanlage_oranienburg
shell: bash