release #11
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 | |
on: | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
max-parallel: 6 | |
matrix: | |
node-version: [18.x] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v1 | |
with: | |
node-version: ${{ matrix.node-version }} | |
# Use nodejs cache | |
- name: Cache Node.js modules | |
uses: actions/cache@v2 | |
with: | |
# npm cache files are stored in `~/.npm` on Linux/macOS | |
path: ~/.npm | |
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.OS }}-node- | |
${{ runner.OS }}- | |
# Enable conversion to PDF | |
- run: sudo sed -i 's/policy domain="coder" rights="none" pattern="PDF"/policy domain="coder" rights="read | write" pattern="PDF"'/ /etc/ImageMagick-6/policy.xml | |
# Install packages and build | |
- run: npm clean-install . | |
- run: npm run lint | |
- run: npm run test | |
- run: npm run build | |
- run: ./makedeb.sh | |
# We may need the package name for a release later (if not the dev branch and it's node 12) | |
- name: Retrieve package name | |
run: | | |
echo "PACKAGE_NAME=$(ls ./debian/scanservjs_*.deb)" >> $GITHUB_ENV | |
# Create a draft release if there's a package | |
- name: Create Release | |
id: create_release | |
if: env.PACKAGE_NAME | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
draft: true | |
prerelease: true | |
# Upload the release package | |
- name: Upload Release Asset | |
id: upload-release-asset | |
if: env.PACKAGE_NAME | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./release/${{ env.PACKAGE_NAME }} | |
asset_name: ${{ env.PACKAGE_NAME }} | |
asset_content_type: application/vnd.debian.binary-package |