Skip to content

Docs: Added dark video version #16

Docs: Added dark video version

Docs: Added dark video version #16

name: Release on Merge
on:
pull_request:
types: [closed]
branches:
- main
jobs:
release:
# Only run if PR was merged AND has the 'release' label
if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'release')
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Create Release
id: create_release
uses: dexwritescode/release-on-merge-action@v1
with:
version-increment-strategy: patch
tag-prefix: v
generate-release-notes: true
body: |
## Docker Images
This release is available on GitHub Container Registry:
```bash
docker pull ghcr.io/sveneisenschmidt/n8n-openai-bridge:latest
docker pull ghcr.io/sveneisenschmidt/n8n-openai-bridge:${{ github.ref_name }}
```
See [README.md](https://github.com/sveneisenschmidt/n8n-openai-bridge#readme) for usage instructions.
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Fetch tags
run: git fetch --tags
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract version from tag
id: version
run: |
# Get the newly created tag from the release action
TAG=$(git describe --tags --abbrev=0)
VERSION=${TAG#v}
echo "tag=$TAG" >> $GITHUB_OUTPUT
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "major=$(echo $VERSION | cut -d. -f1)" >> $GITHUB_OUTPUT
echo "minor=$(echo $VERSION | cut -d. -f1,2)" >> $GITHUB_OUTPUT
- name: Update Release Notes with Docker Tags
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION="${{ steps.version.outputs.version }}"
TAG="${{ steps.version.outputs.tag }}"
MINOR="${{ steps.version.outputs.minor }}"
MAJOR="${{ steps.version.outputs.major }}"
# Get current release body
RELEASE_BODY=$(gh release view "$TAG" --json body -q .body)
# Update Docker image references
UPDATED_BODY=$(cat <<EOF
## Docker Images
This release is available on GitHub Container Registry:
\`\`\`bash
docker pull ghcr.io/sveneisenschmidt/n8n-openai-bridge:latest
docker pull ghcr.io/sveneisenschmidt/n8n-openai-bridge:$VERSION
docker pull ghcr.io/sveneisenschmidt/n8n-openai-bridge:$MINOR
docker pull ghcr.io/sveneisenschmidt/n8n-openai-bridge:$MAJOR
\`\`\`
See [README.md](https://github.com/sveneisenschmidt/n8n-openai-bridge#readme) for usage instructions.
${RELEASE_BODY#*instructions.}
EOF
)
# Update release
gh release edit "$TAG" --notes "$UPDATED_BODY"
- name: Build and Push Docker Image
uses: docker/build-push-action@v5
with:
context: .
file: ./docker/Dockerfile.build
platforms: linux/amd64,linux/arm64
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/n8n-openai-bridge:latest
ghcr.io/${{ github.repository_owner }}/n8n-openai-bridge:${{ steps.version.outputs.version }}
ghcr.io/${{ github.repository_owner }}/n8n-openai-bridge:${{ steps.version.outputs.minor }}
ghcr.io/${{ github.repository_owner }}/n8n-openai-bridge:${{ steps.version.outputs.major }}
cache-from: type=gha
cache-to: type=gha,mode=max