Add write permissions to contents in release-package.yml #3
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: Release | |
# Trigger the workflow on pushes to the main branch, as well as workflow calls | |
on: | |
push: | |
branches: | |
- main | |
workflow_call: | |
secrets: | |
NPM_TOKEN: | |
required: true | |
permissions: | |
contents: write | |
jobs: | |
release: | |
name: Release to NPM | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
with: | |
# Perform a full git history checkout to enable semantic-release analysis | |
fetch-depth: 0 | |
- name: Setup Bun | |
uses: oven-sh/setup-bun@v1 | |
with: | |
bun-version: 'latest' | |
- name: Install Dependencies | |
run: bun install | |
# Use Bun to install dependencies faster | |
- name: Build Project | |
run: bun run build | |
- name: Run Tests | |
run: bun run test | |
- name: Release to NPM | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: bun x semantic-release | |
- name: Upload Code Coverage | |
uses: codecov/[email protected] |