Publish Package to NPM and Dockerhub #23
This file contains hidden or 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: Publish Package to NPM and Dockerhub | |
on: | |
release: | |
types: [created] | |
workflow_dispatch: # Allows manual triggering from the GitHub UI | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
registry-url: 'https://registry.npmjs.org' | |
- run: npm i | |
- run: npm run build | |
publish-npm: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: bitovi/github-actions-npm-publish@dev | |
with: | |
update_type: 'patch' | |
npm_token: ${{ secrets.NPM_TOKEN }} | |
publish: true | |
git_user_name: "[email protected]" | |
build-and-publish-image: | |
runs-on: ubuntu-latest | |
needs: publish-npm | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Tag the image | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: | | |
bitovi/n8n-nodes-markitdown | |
tags: | | |
type=raw,value=${{ inputs.project }}latest,enable=${{ github.ref_name == 'main' }} | |
type=semver,pattern=${{ inputs.project }}-{{version}},enable=${{ github.event_name == 'release' }} | |
- | |
name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
if: github.event_name != 'pull_request' | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- | |
name: Build Docker image | |
uses: docker/build-push-action@v4 | |
with: | |
context: ${{ inputs.project }} | |
platforms: linux/amd64,linux/arm64 | |
tags: ${{ steps.meta.outputs.tags }} | |
- | |
name: Push Docker image | |
uses: docker/build-push-action@v4 | |
if: ${{ (github.ref_name == 'main') || (github.event_name == 'release') }} | |
with: | |
context: ${{ inputs.project }} | |
platforms: linux/amd64,linux/arm64 | |
tags: ${{ steps.meta.outputs.tags }} | |
push: true |