Publish #4
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: scripts/build-packages | |
- name: Upload build artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: awsudo:${{github.ref_name}} | |
path: awsudo-${{github.ref_name}}.tgz | |
Deploy_Docker_Image: | |
runs-on: ubuntu-latest | |
needs: Publish | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- name: Download build artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: awsudo:${{github.ref_name}} | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build Docker image | |
run: scripts/deploy-docker |