Skip to content

Commit

Permalink
👷‍♀️ Fix release
Browse files Browse the repository at this point in the history
  • Loading branch information
alecgibson committed Oct 17, 2024
1 parent 8ccf34f commit 235357d
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 57 deletions.
14 changes: 6 additions & 8 deletions .github/workflows/npm-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,10 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
# Use PAT instead of default Github token, because the default
# token deliberately will not trigger another workflow run
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
- uses: actions/setup-node@v3
with:
node-version: '16.x'
node-version: '20.x'
registry-url: 'https://npm.pkg.github.com'
- name: Install
# Skip post-install to avoid malicious scripts stealing PAT
Expand All @@ -29,4 +25,6 @@ jobs:
run: npm test
- name: Tag
if: ${{ github.ref == 'refs/heads/main' }}
run: ./tag.sh
run: ./release.sh
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23 changes: 0 additions & 23 deletions .github/workflows/publish.yml

This file was deleted.

23 changes: 23 additions & 0 deletions release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

VERSION="v$(node -p "require('./package.json').version")"

git checkout main
git pull
git fetch --tags
VERSION_COUNT=$(git tag --list $VERSION | wc -l)

if [ $VERSION_COUNT -gt 0 ]
then
echo "Version $VERSION already deployed"
exit 0
else
echo "Deploying version $VERSION"
fi

echo '!/dist' >> .gitignore

git tag $VERSION
git push origin refs/tags/$VERSION

npm publish
26 changes: 0 additions & 26 deletions tag.sh

This file was deleted.

0 comments on commit 235357d

Please sign in to comment.