Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update workflow for npm publish #13

Merged
merged 1 commit into from
Nov 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion .github/workflows/release-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jobs:
with:
node-version: 20
cache: npm
registry-url: 'https://registry.npmjs.org'

- name: Install dependencies
run: npm ci
Expand All @@ -42,6 +43,14 @@ jobs:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release

- name: Build Package
run: npm run build

- name: Publish to NPM
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm publish --access public

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

Expand All @@ -51,12 +60,18 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Get Version
id: get_version
run: |
VERSION=$(node -p "require('./package.json').version")
echo "VERSION=${VERSION}" >> $GITHUB_ENV

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
push: true
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/echo-service:latest
${{ secrets.DOCKERHUB_USERNAME }}/echo-service:${{ env.RELEASE_VERSION }}
${{ secrets.DOCKERHUB_USERNAME }}/echo-service:${{ env.VERSION }}
cache-from: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/echo-service:buildcache
cache-to: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/echo-service:buildcache,mode=max