Update dependencies #12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release Package | |
on: | |
push: | |
branches: [main] | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
name: Release Package | |
services: | |
memcached: | |
image: memcached:latest | |
ports: | |
- 11211:11211/tcp | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.git_token || github.token }} | |
- name: Setup NodeJS | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.x | |
registry-url: https://registry.npmjs.org | |
- name: Build Package | |
run: | | |
npm clean-install | |
npm run build | |
- name: Publish Package | |
run: | | |
VERSION="$(node -p 'require("./package.json").version')" | |
test -z "$(git ls-remote --tags origin "v${VERSION}")" || { | |
echo "Release ${VERSION} already tagged, exiting..." | |
echo "::notice::Release ${VERSION} already tagged" | |
exit 0 | |
} | |
git config user.email '[email protected]' | |
git config user.name 'Github Workflows' | |
git tag -a -m "v${VERSION}" "v${VERSION}" "${{ github.sha }}" | |
git push --tags | |
gh release create "v${VERSION}" \ | |
--title "Release ${VERSION}" \ | |
--target "${{ github.sha }}" \ | |
--verify-tag | |
npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.npm_token }} | |
GH_TOKEN: ${{ github.token }} |