Add permission def for release.yml #6
Workflow file for this run
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 | |
# Add permissions configuration at the top level | |
permissions: | |
contents: write | |
discussions: write | |
pull-requests: write | |
on: | |
push: | |
tags: | |
- 'v*' # run if tag starts with v | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Install dependencies | |
run: npm ci | |
- name: Build | |
run: npm run build | |
- name: Prepare release packages | |
run: | | |
# Prepare Windows package | |
mkdir -p release/windows | |
cp exe/windows/inj.exe release/windows/ | |
cp -r dist release/windows/ | |
cp package.json release/windows/ | |
cp package-lock.json release/windows/ | |
cd release | |
zip -r windows.zip windows/ | |
cd .. | |
# Prepare Linux package | |
mkdir -p release/linux | |
cp exe/linux/inj release/linux/ | |
cp -r dist release/linux/ | |
cp package.json release/linux/ | |
cp package-lock.json release/linux/ | |
cd release | |
tar czf linux.tar.gz linux/ | |
cd .. | |
# Prepare macOS package | |
mkdir -p release/macos | |
cp exe/macos/inj release/macos/ | |
cp -r dist release/macos/ | |
cp package.json release/macos/ | |
cp package-lock.json release/macos/ | |
cd release | |
tar czf macos.tar.gz macos/ | |
cd .. | |
- name: Create Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
release/windows.zip | |
release/linux.tar.gz | |
release/macos.tar.gz | |
draft: false | |
prerelease: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |