feat(demo): convert in browser #11
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: test and build | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
workflow_dispatch: | |
permissions: | |
contents: read | |
checks: write | |
pages: write | |
id-token: write | |
concurrency: | |
group: pages | |
cancel-in-progress: false | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: .nvmrc | |
cache: npm | |
- run: npm ci | |
- run: npm run lint | |
- run: npm run test -- --ci --reporters=default --reporters=jest-junit | |
- uses: mikepenz/action-junit-report@v4 | |
if: success() || failure() | |
with: | |
check_name: report | |
include_passed: true | |
report_paths: junit.xml | |
build: | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: .nvmrc | |
cache: npm | |
- run: npm ci | |
- run: npm run build | |
- if: success() && github.ref == 'refs/heads/main' && github.event_name != 'pull_request' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: latest-lib | |
path: lib | |
- if: success() && github.ref == 'refs/heads/main' && github.event_name != 'pull_request' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: latest-dist | |
path: dist | |
deploy: | |
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' | |
needs: build | |
runs-on: ubuntu-latest | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/configure-pages@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: latest-dist | |
path: dist | |
- uses: actions/upload-pages-artifact@v3 | |
with: | |
path: dist | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 | |
release: | |
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' | |
needs: build | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
id-token: write | |
outputs: | |
version: ${{ steps.version.outputs.latest }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: .nvmrc | |
cache: npm | |
registry-url: https://registry.npmjs.org/ | |
- uses: actions/download-artifact@v4 | |
with: | |
name: latest-lib | |
path: lib | |
- run: | | |
git config user.email "${{ vars.NPM_EMAIL }}" | |
git config user.name "${{ vars.NPM_USER }}" | |
npm config set //registry.npmjs.org/:_authToken ${{secrets.NPM_TOKEN}} | |
npm install --global release-it @release-it/conventional-changelog | |
- run: | | |
release-it \ | |
--ci \ | |
--npm.skipChecks \ | |
--npm.publish \ | |
--no-github.release \ | |
--git.commitMessage='chore: release v${version}' \ | |
--git.pushArgs=--follow-tags \ | |
--plugins.@release-it/conventional-changelog.infile=CHANGELOG.md \ | |
--plugins.@release-it/conventional-changelog.header='# Astro Decap Collection' \ | |
--plugins.@release-it/conventional-changelog.preset=angular | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- run: | | |
version=$(node -e "console.log(require('./package.json').version);") | |
echo "Released ${version} :rocket:" >> $GITHUB_STEP_SUMMARY |