flaska/.forgejo/workflows/deploy.yml
Jonatan Nilsson 4226676668
All checks were successful
/ deploy (push) Successful in 9s
add forgejo workflow and deploy v1.4.0
2024-11-10 01:27:19 +00:00

32 lines
1.1 KiB
YAML

on:
push:
branches:
- master
jobs:
deploy:
runs-on: arch
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Install dependencies
run: time npm install
- name: Run Tests
run: npm run test -- --ignore-only
- name: Deply if new version
run: |
echo ""
echo "------------------------------------"
echo ""
CURR_VER="$(cat package.json | jq -r .name)_v$(cat package.json | jq -r .version)"
CURR_NAME="$(cat package.json | jq -r .name) v$(cat package.json | jq -r .version)"
echo "Checking https://git.nfp.is/api/v1/repos/${{ forgejo.repository }}/releases for name ${CURR_NAME}"
if curl -s -X GET -H "Authorization: token ${{ secrets.deploytoken }}" https://git.nfp.is/api/v1/repos/${{ forgejo.repository }}/releases | grep -o "\"name\"\:\"${CURR_NAME}\"" > /dev/null; then
echo "Skipping ${{ forgejo.job }} since $CURR_NAME already exists";
exit;
fi
echo "New release ${CURR_VER} found, beginning deployment"