First commit #6
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: Build and Publish | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
test: | |
name: 🪢 Test | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: ⎔ Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "20.x" | |
registry-url: 'https://npm.pkg.github.com' | |
cache: 'yarn' | |
- name: Install dependencies | |
run: yarn --frozen-lockfile | |
- run: yarn test:ci | |
build: | |
name: 🚧 Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: ⎔ Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "20.x" | |
registry-url: 'https://npm.pkg.github.com' | |
cache: 'yarn' | |
- name: ⛓ Install dependencies | |
run: yarn --frozen-lockfile | |
- name: 📦 Build | |
run: yarn build | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: build-artifact | |
path: ./dist | |
- name: 💾 Cache | |
id: cache-build | |
uses: actions/cache@v3 | |
with: | |
path: ./dist | |
key: ${{ github.sha }} | |
publish: | |
name: 🚀 Publish | |
runs-on: ubuntu-latest | |
needs: [test, build] | |
permissions: | |
contents: write | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: ⎔ Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'yarn' | |
registry-url: https://npm.pkg.github.com/ | |
# - name: Check package version | |
# uses: majortom327/auto-version@v0.0.4 | |
# with: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/cache@v3 | |
id: cache-build | |
with: | |
path: ./dist | |
key: ${{ github.sha }} | |
- name: 🚀 Publish to GitHub Packages | |
run: yarn publish | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
# - name: Publish to npm | |
# uses: JS-DevTools/npm-publish@v1 | |
# with: | |
# token: ${{ secrets.NPM_TOKEN }} | |
# dry-run: false |