37 lines
1.6 KiB
YAML
37 lines
1.6 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
|
|
run: |
|
|
CURR_VER=$(cat package.json | jq -r .version)
|
|
echo "Checking https://git.nfp.is/api/v1/repos/$APPVEYOR_REPO_NAME/releases for version v${CURR_VER}"
|
|
curl -s -X GET -H "Authorization: token ${{ secrets.deploytoken }}" https://git.nfp.is/api/v1/repos/${{ forgejo.repository }}/releases | grep -o "\"name\"\:\"v${CURR_VER}\"" > /dev/null
|
|
|
|
if curl -s -X GET -H "Authorization: token ${{ secrets.deploytoken }}" https://git.nfp.is/api/v1/repos/${{ forgejo.repository }}/releases | grep -o "\"name\":\"v${CURR_VER}\"" > /dev/null; then
|
|
echo "Skipping ${{ forgejo.job }} since $CURR_VER already exists";
|
|
exit 0
|
|
fi
|
|
|
|
echo "Creating release $CURR_VER on forgejo"
|
|
curl \
|
|
-X POST \
|
|
-H "Authorization: token ${{ secrets.deploytoken }}" \
|
|
-H "Content-Type: application/json" \
|
|
https://git.nfp.is/api/v1/repos/${{ forgejo.repository }}/releases \
|
|
-d "{\"tag_name\":\"v${CURR_VER}\",\"name\":\"v${CURR_VER}\",\"body\":\"Automatic release from Forgejo runner from ${{ forgejo.sha }} :\n\n${{ forgejo.event.head_commit.message }}\"}"
|
|
echo '//registry.npmjs.org/:_authToken=${{ secrets.npmtoken }}' > ~/.npmrc
|
|
echo "Publishing $CURR_VER to npm"
|
|
npm publish
|