fs-cache-fast/.gitea/workflows/deploy.yaml

45 lines
1.7 KiB
YAML
Raw Permalink Normal View History

on:
push:
branches:
- master
2024-09-21 00:30:58 +00:00
- meme
jobs:
deploy:
runs-on: alpine
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Test
run: |
npm install
npm test
- name: Check for new release
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/${{ gitea.repository }}/releases for name ${CURR_NAME}"
if curl -s -X GET -H "Authorization: token ${{ secrets.deploytoken }}" https://git.nfp.is/api/v1/repos/${{ gitea.repository }}/releases | grep -o "\"name\"\:\"${CURR_NAME}\"" > /dev/null; then
echo "Skipping ${{ gitea.job }} since $CURR_NAME already exists";
exit;
fi
echo "New release ${CURR_VER} found, running npm install..."
echo "Creating ${CURR_VER} release on gitea"
curl \
-X POST \
-H "Authorization: token ${{ secrets.deploytoken }}" \
-H "Content-Type: application/json" \
https://git.nfp.is/api/v1/repos/${{ gitea.repository }}/releases \
-d "{\"tag_name\":\"${CURR_VER}\",\"name\":\"${CURR_NAME}\",\"body\":\"Automatic release from Appveyor from ${{ gitea.sha }} :\n\n${{ gitea.event.head_commit.message }}\"}"
echo "//registry.npmjs.org/:_authToken=${{ secrets.npmtoken }}" > ~/.npmrc
echo "Publishing new version to npm"
npm publish