Update issue templates #16
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: Deploy to npm | |
on: | |
push: | |
branches: | |
- master | |
permissions: | |
contents: write | |
jobs: | |
publish-npm: | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout the repository | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.HUB_TOKEN }} | |
# Set up Node.js environment | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
registry-url: 'https://registry.npmjs.org/' | |
# Install dependencies | |
- name: Install dependencies | |
run: npm install | |
# Get the short hash of the last commit | |
- name: Get short commit hash | |
id: get_hash | |
run: echo "HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | |
# Update the version in package.json | |
- name: Update version | |
id: update_version | |
run: | | |
VERSION="0.0.1-alpha.$HASH" | |
jq --arg ver "$VERSION" '.version = $ver' package.json > tmp.json && mv tmp.json package.json | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
# Build the package | |
- name: Build package | |
run: npm run make | |
# Run tests | |
- name: Run tests | |
run: npx jest --coverage | |
# Upload results to Codecov | |
- name: Upload results to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
# Create Git tag | |
- name: Create Git tag | |
run: | | |
git config --local user.name "github-actions[bot]" | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git tag ${{ env.VERSION }} | |
git push origin ${{ env.VERSION }} | |
# Create GitHub Release | |
- name: Create GitHub Release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.HUB_TOKEN }} | |
with: | |
tag_name: ${{ env.VERSION }} | |
release_name: Release ${{ env.VERSION }} | |
draft: false | |
prerelease: true | |
# Publish to npm | |
- name: Publish to npm | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: npm publish |