Skip to content

Commit deb9e2e

Browse files
feat: Add custom publish workflows (#27)
feat: add custom publish workflows for npm and docker
1 parent 4c568f0 commit deb9e2e

File tree

2 files changed

+99
-17
lines changed

2 files changed

+99
-17
lines changed
Lines changed: 51 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,55 @@
1-
name: Publish Docker Image
1+
name: Publish to Docker Hub
22

33
on:
4-
release:
5-
types: [published]
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- "v*"
9+
workflow_dispatch:
10+
inputs:
11+
version:
12+
description: "Version (e.g., 1.0.0)"
13+
required: true
14+
type: string
15+
env:
16+
IMAGE_NAME: iexec/mcp-server
617

718
jobs:
8-
publish:
9-
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/[email protected]
10-
with:
11-
dockerfile: "Dockerfile"
12-
image-name: "iexechub/mcp-server"
13-
secrets:
14-
dockerhub-username: ${{ secrets.DOCKERHUB_USERNAME }}
15-
dockerhub-pat: ${{ secrets.DOCKERHUB_TOKEN }}
19+
publish-docker:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v4
24+
25+
- name: Get version
26+
id: version
27+
run: |
28+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
29+
VERSION="${{ github.event.inputs.version }}"
30+
else
31+
VERSION=${GITHUB_REF#refs/tags/v}
32+
fi
33+
echo "version=$VERSION" >> $GITHUB_OUTPUT
34+
echo "Building Docker image: $VERSION"
35+
36+
- name: Login to Docker Hub
37+
uses: docker/login-action@v3
38+
with:
39+
username: ${{ secrets.DOCKERHUB_USERNAME}}
40+
password: ${{ secrets.DOCKERHUB_TOKEN }}
41+
42+
- name: Build and push Docker image
43+
uses: docker/build-push-action@v5
44+
with:
45+
context: .
46+
push: true
47+
platforms: linux/amd64,linux/arm64
48+
tags: |
49+
${{ env.IMAGE_NAME }}:${{ steps.version.outputs.version }}
50+
${{ env.IMAGE_NAME }}:latest
51+
52+
- name: Success notification
53+
run: |
54+
echo "✅ Docker image published: v${{ steps.version.outputs.version }}"
55+
echo "🐳 https://hub.docker.com/r/${{ env.IMAGE_NAME }}"

.github/workflows/publish-npm.yml

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,53 @@
1-
name: Publish NPM Package
1+
name: Publish to npm
22

33
on:
4-
release:
5-
types: [published]
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- "v*"
9+
workflow_dispatch:
10+
inputs:
11+
version:
12+
description: "Version (e.g., 1.0.0)"
13+
required: true
14+
type: string
615

716
jobs:
817
publish:
9-
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/[email protected]
10-
secrets:
11-
npm-token: ${{ secrets.NPM_TOKEN }}
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
23+
- name: Setup Node.js
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: "18"
27+
registry-url: "https://registry.npmjs.org"
28+
29+
- name: Get version
30+
id: version
31+
run: |
32+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
33+
VERSION="${{ github.event.inputs.version }}"
34+
else
35+
VERSION=${GITHUB_REF#refs/tags/v}
36+
fi
37+
echo "version=$VERSION" >> $GITHUB_OUTPUT
38+
echo "Publishing version: $VERSION"
39+
40+
- name: Install and build
41+
run: |
42+
npm ci
43+
npm run build
44+
45+
- name: Publish to npm
46+
run: npm publish --tag latest
47+
env:
48+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
49+
50+
- name: Success
51+
run: |
52+
echo "✅ Published v${{ steps.version.outputs.version }}"
53+
echo "📦 npm: https://www.npmjs.com/package/@iexec/mcp-server"

0 commit comments

Comments
 (0)