Skip to content

v0.0.4

v0.0.4 #1

Workflow file for this run

name: Release Docker Image
on:
release:
types: [published]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract version from tag
id: version
run: |
# Remove 'v' prefix if present (e.g., v1.0.0 -> 1.0.0)
VERSION=${GITHUB_REF_NAME#v}
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Version: $VERSION"
- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm64
- name: Update release with Docker instructions
uses: actions/github-script@v7
with:
script: |
const version = '${{ steps.version.outputs.version }}';
const imageName = '${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}';
const dockerInstructions = `
## Docker Image
This release is available as a Docker image:
\`\`\`bash
docker pull ${imageName}:${version}
docker pull ${imageName}:latest
\`\`\`
### Quick Start
\`\`\`bash
docker run -d \\
--name n8n-openai-bridge \\
-p 3333:3333 \\
-e BEARER_TOKEN=your-secret-key \\
-v ./models.json:/app/models.json:ro \\
${imageName}:${version}
\`\`\`
See [README.md](https://github.com/${{ github.repository }}) for full documentation.
`;
const { data: release } = await github.rest.repos.getReleaseByTag({
owner: context.repo.owner,
repo: context.repo.repo,
tag: context.ref.replace('refs/tags/', '')
});
await github.rest.repos.updateRelease({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: release.id,
body: release.body + dockerInstructions
});