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

42 lines
1.3 KiB
YAML
Raw Normal View History

2023-06-25 04:49:23 +00:00
name: Build/Publish
on:
2023-06-25 05:00:39 +00:00
workflow_call:
2023-06-25 04:49:23 +00:00
jobs:
build:
runs-on: ubuntu-latest
2023-06-25 05:11:21 +00:00
outputs:
cache-primary-key: ${{ steps.cache.outputs.cache-primary-key }}
2023-06-25 04:49:23 +00:00
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 node modules
id: cache
uses: actions/cache@v3
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ./
key: ${{ runner.os }}-build-${{ hashFiles('**/package-lock.json','lib/**') }}
publish:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/cache/restore@v3
with:
path: .
2023-06-25 05:11:21 +00:00
key: ${{ needs.build.outputs.cache-primary-key }}
2023-06-25 04:49:23 +00:00
- 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