Publish #14
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: NPM Pipeline | |
on: | |
workflow_run: | |
workflows: ["Node.js CI test"] | |
types: | |
- completed | |
push: | |
tags: | |
- "v*" | |
jobs: | |
Publish: | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
cache: "npm" | |
registry-url: https://registry.npmjs.org | |
cache-dependency-path: package-lock.json | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} | |
- name: Install dependencies | |
run: npm ci | |
- name: Publish package | |
run: npm publish | |
- name: Build package | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y ruby-dev build-essential rpm | |
sudo gem install fpm | |
sudo scripts/build-packages | |
- name: Create Release | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: "*.deb,*.rpm" | |
name: ${{ github.ref }} | |
tag: ${{ github.ref }} | |
Deploy_Docker_Image: | |
runs-on: ubuntu-latest | |
needs: Publish | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build Docker image | |
run: sudo scripts/deploy-docker |