2024-11-10 00:29:08 +00:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
deploy:
|
|
|
|
runs-on: arch
|
|
|
|
steps:
|
|
|
|
- name: Check out repository code
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Install dependencies
|
2024-11-10 01:39:22 +00:00
|
|
|
run: time pnpm install
|
2024-11-10 00:29:08 +00:00
|
|
|
- name: Run Tests
|
2024-11-10 01:39:22 +00:00
|
|
|
run: pnpm run test -- --ignore-only
|
2024-11-10 00:29:08 +00:00
|
|
|
- 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/${{ github.repository }}/releases for name ${CURR_NAME}"
|
|
|
|
|
|
|
|
if curl -s -X GET -H "Authorization: token ${{ secrets.deploytoken }}" https://git.nfp.is/api/v1/repos/${{ github.repository }}/releases | grep -o "\"name\":\"${CURR_NAME}\"" > /dev/null; then
|
|
|
|
echo "Skipping ${{ github.job }} since $CURR_NAME already exists";
|
|
|
|
exit;
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "New release ${CURR_VER} found, beginning deployment"
|
|
|
|
|
|
|
|
echo "Creating ${CURR_VER} release on forgejo"
|
|
|
|
curl \
|
|
|
|
-X POST \
|
|
|
|
-H "Authorization: token ${{ secrets.deploytoken }}" \
|
|
|
|
-H "Content-Type: application/json" \
|
|
|
|
https://git.nfp.is/api/v1/repos/${{ github.repository }}/releases \
|
2024-11-10 01:39:22 +00:00
|
|
|
-d "{\"tag_name\":\"${CURR_VER}\",\"name\":\"${CURR_NAME}\",\"body\":\"Automatic release from Appveyor from ${{ github.sha }} :\n\n${{ github.event.head_commit.message }}\"}" | jq
|
2024-11-10 00:29:08 +00:00
|
|
|
|
|
|
|
echo "//registry.npmjs.org/:_authToken=${{ secrets.npmtoken }}" > ~/.npmrc
|
|
|
|
echo "Publishing new version to npm"
|
|
|
|
npm publish
|