Add deployment workflow and configure webmention token handling
All checks were successful
Deploy / deploy (push) Successful in 1m16s
All checks were successful
Deploy / deploy (push) Successful in 1m16s
This commit is contained in:
parent
934a9f2338
commit
6e1ee689ea
2 changed files with 57 additions and 0 deletions
54
.forgejo/workflows/deploy.yml
Normal file
54
.forgejo/workflows/deploy.yml
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
name: Deploy
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: self-hosted
|
||||
env:
|
||||
DEPLOY_DIR: /opt/websites/adrian-altner.de
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Sync to deploy directory
|
||||
run: |
|
||||
sudo rsync -a --delete \
|
||||
--exclude='.env' \
|
||||
--exclude='.env.production' \
|
||||
--exclude='.git/' \
|
||||
--exclude='node_modules/' \
|
||||
./ "${DEPLOY_DIR}/"
|
||||
|
||||
- name: Build image
|
||||
run: |
|
||||
cd "${DEPLOY_DIR}"
|
||||
sudo podman build \
|
||||
--build-arg WEBMENTION_TOKEN="${{ secrets.WEBMENTION_TOKEN }}" \
|
||||
-t localhost/adrian-altner.de:latest .
|
||||
|
||||
- name: Restart service
|
||||
run: sudo systemctl restart podman-compose@adrian-altner.de.service
|
||||
|
||||
- name: Prune
|
||||
run: |
|
||||
sudo podman container prune -f 2>/dev/null || true
|
||||
sudo podman image prune --external -f 2>/dev/null || true
|
||||
sudo podman image prune -f 2>/dev/null || true
|
||||
sudo podman builder prune -af 2>/dev/null || true
|
||||
|
||||
- name: Send webmentions
|
||||
env:
|
||||
WEBMENTION_APP_TOKEN: ${{ secrets.WEBMENTION_APP_TOKEN }}
|
||||
run: |
|
||||
if [ -z "$WEBMENTION_APP_TOKEN" ]; then
|
||||
echo "No WEBMENTION_APP_TOKEN — skipping."
|
||||
exit 0
|
||||
fi
|
||||
for feed in rss.xml en/rss.xml; do
|
||||
curl -s -X POST "https://webmention.app/check?url=https://adrian-altner.de/${feed}&token=${WEBMENTION_APP_TOKEN}" \
|
||||
| grep -o '"status":"[^"]*"' || true
|
||||
done
|
||||
|
|
@ -1,5 +1,8 @@
|
|||
FROM node:22-bookworm-slim AS build
|
||||
|
||||
ARG WEBMENTION_TOKEN=""
|
||||
ENV WEBMENTION_TOKEN=$WEBMENTION_TOKEN
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY package.json package-lock.json ./
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue