Skip to content

Bump actions/upload-artifact from 4.3.4 to 4.3.5 in the minor group #221

Bump actions/upload-artifact from 4.3.4 to 4.3.5 in the minor group

Bump actions/upload-artifact from 4.3.4 to 4.3.5 in the minor group #221

Workflow file for this run

name: Schema
on:
push:
pull_request:
jobs:
generate:
# Deduplicate jobs from pull requests and branch pushes within the same repo.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
runs-on: ubuntu-latest
steps:
- name: Install Rover CLI
run: |
curl -sSL https://rover.apollo.dev/nix/latest | sh
echo "$HOME/.rover/bin" >> $GITHUB_PATH
- name: Checkout Source
uses: actions/checkout@v4.1.7
- name: Compose Supergraph Schema
run: >
rover supergraph compose
--config supergraph-config.yaml
--elv2-license=accept
> supergraph.graphql
- name: Upload New Schema Artifact
uses: actions/upload-artifact@v4.3.5
with:
name: supergraph.graphql
path: supergraph.graphql
publish:
# Deduplicate jobs from pull requests and branch pushes within the same repo.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
needs:
- generate
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout source
uses: actions/checkout@v4.1.7
- name: Setup Helm
uses: azure/setup-helm@v4.2.0
- name: Download Schema Artifact
uses: actions/download-artifact@v4.1.8
with:
name: supergraph.graphql
path: charts/supergraph
- name: Package Chart
run: helm package charts/supergraph
- name: Generate Image Name
run: echo IMAGE_REPOSITORY=oci://ghcr.io/$(echo "${{ github.repository }}-supergraph" | tr '[:upper:]' '[:lower:]' | tr '[_]' '[\-]') >> $GITHUB_ENV
- name: Log in to GitHub Docker Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3.3.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Publish Chart
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: helm push $(ls supergraph-*.tgz) ${{ env.IMAGE_REPOSITORY }}
compare_schema:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' }}
steps:
- name: Install Rover CLI
run: |
curl -sSL https://rover.apollo.dev/nix/latest | sh
echo "$HOME/.rover/bin" >> $GITHUB_PATH
- name: Checkout main branch
uses: actions/checkout@v4.1.7
with:
ref: main
- name: Compose old Supergraph Schema
run: >
rover supergraph compose
--config supergraph-config.yaml
--elv2-license=accept
> /tmp/old_supergraph.graphql
- name: Checkout Source
uses: actions/checkout@v4.1.7
- name: Compose New Supergraph Schema
run: >
rover supergraph compose
--config supergraph-config.yaml
--elv2-license=accept
> supergraph.graphql
- name: Generate Schema Diff
run: |
git --no-pager diff --no-index --no-exit-code --minimal /tmp/old_supergraph.graphql supergraph.graphql > diff.md
if [ -s diff.md ]; then echo "has_diff=true" >> $GITHUB_ENV; fi
sed -i 1,4d diff.md
sed -i '1s/^/```diff\n/; $a```' diff.md
- name: Comment PR with artefact comparison report
if: env.has_diff == 'true'
uses: JoseThen/comment-pr@v1.2.0
with:
file_path: diff.md
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}