Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ci): set permissions for dry-run of release #81

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ jobs:
lint:
name: 'Lint'
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -37,6 +39,8 @@ jobs:
build-and-test:
name: 'Build and Test'
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -68,11 +72,6 @@ jobs:
- name: Test Node from .nvmrc
run: yarn test:nodejs

- name: Release dry-run
run: yarn release --dry-run --no-ci --branches "${{ github.base_ref || github.ref_name }}"
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Switch to Node 20
uses: actions/setup-node@v4
Expand Down Expand Up @@ -111,9 +110,11 @@ jobs:

release:
name: Semantic release
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: [lint, build-and-test]
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -138,7 +139,14 @@ jobs:
- name: Install deps
if: steps.cache-node_modules.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile
- name: Release dry-run
if: github.event_name != 'push' || github.ref != 'refs/heads/main'
run: yarn release --dry-run --no-ci --branches "${{ github.ref_name }}"
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Release
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: yarn release
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
Expand Down
Loading