Fix/release please permissions (#6) #9
This file contains hidden or 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 Please | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: write | |
pull-requests: write | |
issues: write | |
jobs: | |
release-please: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: googleapis/release-please-action@v4 | |
id: release | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
config-file: release-please-config.json | |
manifest-file: .release-please-manifest.json | |
# Publish to npm if a release was created | |
- uses: actions/checkout@v4 | |
if: ${{ steps.release.outputs.release_created }} | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
if: ${{ steps.release.outputs.release_created }} | |
with: | |
node-version: '20' | |
cache: 'npm' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Install dependencies | |
if: ${{ steps.release.outputs.release_created }} | |
run: npm ci | |
- name: Build | |
if: ${{ steps.release.outputs.release_created }} | |
run: npm run build | |
- name: Publish to npm | |
if: ${{ steps.release.outputs.release_created }} | |
run: npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
# Build and upload FoundryVTT module artifacts if module was released | |
- name: Create FoundryVTT module zip | |
if: ${{ steps.release.outputs['foundry-local-rest-api--release_created'] }} | |
run: | | |
cd foundry-local-rest-api | |
zip -r ../foundry-local-rest-api.zip . -x "*.git*" "node_modules/*" "*.DS_Store*" | |
cd .. | |
- name: Upload FoundryVTT module artifacts | |
if: ${{ steps.release.outputs['foundry-local-rest-api--release_created'] }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
TAG_NAME=${{ steps.release.outputs['foundry-local-rest-api--tag_name'] }} | |
gh release upload "${TAG_NAME}" foundry-local-rest-api.zip foundry-local-rest-api/module.json |