|
| 1 | +name: Publish @simplewebauthn/browser |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + |
| 6 | +jobs: |
| 7 | + publish: |
| 8 | + runs-on: ubuntu-latest |
| 9 | + |
| 10 | + permissions: |
| 11 | + contents: read |
| 12 | + id-token: write # The OIDC ID token is used for authentication with JSR and NPM |
| 13 | + |
| 14 | + env: |
| 15 | + NODE_VERSION: '22.x' |
| 16 | + DENO_VERSION: 'v2.4.x' |
| 17 | + |
| 18 | + steps: |
| 19 | + - uses: actions/checkout@v5 |
| 20 | + |
| 21 | + # Install Node |
| 22 | + - name: Setup Node.js ${{ env.NODE_VERSION }} |
| 23 | + uses: actions/setup-node@v5 |
| 24 | + with: |
| 25 | + node-version: ${{ env.NODE_VERSION }} |
| 26 | + registry-url: 'https://registry.npmjs.org' |
| 27 | + - name: Upgrade NPM |
| 28 | + # Trusted Publishing requires at least npm 11.5.1 |
| 29 | + run: npm install -g npm@^11.5.1 |
| 30 | + |
| 31 | + - name: Confirm installed Node and NPM versions |
| 32 | + run: 'echo "Node: $(node -v)" && echo "NPM: $(npm -v)"' |
| 33 | + |
| 34 | + # Install Deno |
| 35 | + - name: Setup Deno ${{ env.DENO_VERSION }} |
| 36 | + uses: denoland/setup-deno@v2 |
| 37 | + with: |
| 38 | + deno-version: ${{ env.DENO_VERSION }} |
| 39 | + - name: Confirm installed Deno version |
| 40 | + run: deno -V |
| 41 | + |
| 42 | + # Set up caching for quicker installs |
| 43 | + - name: Get DENO_DIR store directory |
| 44 | + shell: bash |
| 45 | + # Expecting "DENO_DIR location: /Users/matt/Library/Caches/deno" somewhere in `deno info` |
| 46 | + run: | |
| 47 | + echo "DENO_DIR=$(deno info | grep "DENO_DIR" | awk '{print $3}')" >> $GITHUB_ENV |
| 48 | + - name: Setup Deno cache |
| 49 | + uses: actions/cache@v4 |
| 50 | + with: |
| 51 | + path: ${{ env.DENO_DIR }} |
| 52 | + key: ${{ runner.os }}-deno-dir-${{ hashFiles('**/deno.lock') }} |
| 53 | + restore-keys: | |
| 54 | + ${{ runner.os }}-deno-dir- |
| 55 | +
|
| 56 | + # Install deps |
| 57 | + - name: Install dependencies |
| 58 | + run: deno install |
| 59 | + |
| 60 | + # Publish to JSR and NPM |
| 61 | + - name: Publish to JSR and NPM |
| 62 | + run: deno task publish:browser |
0 commit comments