github-node-deploy-workflow/.github/workflows/main.yml

40 lines
1.3 KiB
YAML

name: Build/Publish
on:
workflow_call:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: 'npm'
- run: npm ci
- run: npm run build --if-present
- name: Cache build
id: cache
uses: LumeWeb/github-action-cache/save@v3
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ./
key: cache-${{ github.run_id }}-${{ github.run_attempt }}
publish:
runs-on: ubuntu-latest
needs: build
steps:
- uses: LumeWeb/github-action-cache/restore@v3
with:
path: .
key: cache-${{ github.run_id }}-${{ github.run_attempt }}
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.GITEA_SSH_KEY }}
name: gitea # optional
known_hosts: ${{ secrets.GITEA_KNOWN_HOST }}
- run: npm run semantic-release