Merge pull request #14 from FuelLabs/patch-cm #22
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: Build and publish Docker image | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
types: [opened, synchronize] | |
release: | |
types: [published] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build-and-publish-image: | |
runs-on: ubuntu-latest | |
if: | | |
(github.event_name == 'release' && github.event.action == 'published') || | |
github.ref == 'refs/heads/main' || | |
(github.event_name == 'pull_request' && | |
github.event.pull_request.head.repo.full_name == github.repository) | |
permissions: | |
contents: read | |
packages: write | |
outputs: | |
docs-changed: ${{ steps.check-docs.outputs.docs-changed }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: Check for docs changes | |
id: check-docs | |
run: | | |
if git diff --name-only HEAD~1 HEAD | grep -q "^docs/"; then | |
echo "docs-changed=true" >> $GITHUB_OUTPUT | |
else | |
echo "docs-changed=false" >> $GITHUB_OUTPUT | |
fi | |
- name: Build and push app image | |
uses: ./.github/actions/docker-publish | |
id: publish-app | |
with: | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
image: ghcr.io/fuellabs/fuel-mcp-server | |
dockerfile: deployment/Dockerfile | |
context: . | |
- name: Check if indexer image exists | |
id: check-indexer | |
run: | | |
if docker manifest inspect ghcr.io/fuellabs/fuel-mcp-server-indexer:latest >/dev/null 2>&1; then | |
echo "indexer-exists=true" >> $GITHUB_OUTPUT | |
else | |
echo "indexer-exists=false" >> $GITHUB_OUTPUT | |
fi | |
- name: Build and push indexer image | |
if: steps.check-docs.outputs.docs-changed == 'true' || steps.check-indexer.outputs.indexer-exists == 'false' | |
uses: ./.github/actions/docker-publish | |
id: publish-indexer | |
with: | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
image: ghcr.io/fuellabs/fuel-mcp-server-indexer | |
dockerfile: deployment/Dockerfile.indexer | |
context: . |