Merge pull request #12 from yodatak/patch-1 #14
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: Publish package to npmjs | |
on: | |
push: | |
branches: [main] | |
env: | |
BASE: /slidev-addon-asciinema | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 14 | |
registry-url: 'https://registry.npmjs.org' | |
- name: Configure git credentials | |
run: | | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
git config user.name "Github Actions" | |
- run: yarn version --patch | |
- run: yarn | |
- run: yarn publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Push commits and tags | |
run: git push --follow-tags # `yarn` already commits and tags | |
- name: Get latest tag (added by yarn) | |
run: echo "TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV | |
- name: Create release | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
github.rest.repos.createRelease({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
tag_name: "${{ env.TAG }}", | |
generate_release_notes: true | |
}) | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '14' | |
- name: Install dependencies | |
run: yarn install | |
- name: Build | |
run: yarn build --base ${{ env.BASE }} | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
path: dist/ | |
deploy: | |
needs: build | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
permissions: | |
pages: write | |
id-token: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v2 |