Skip to content

feat(serve): JIT

feat(serve): JIT #7705

Workflow file for this run

name: pr
on:
pull_request:
jobs:
dependencies:
if: ${{ github.event.pull_request.title != 'Upcoming Release Changes' }}
uses: the-guild-org/shared-config/.github/workflows/changesets-dependencies.yml@v1
with:
node-version-file: .node-version
secrets:
githubToken: ${{ secrets.GUILD_BOT_TOKEN }}
release:
if: ${{ github.event.pull_request.title != 'Upcoming Release Changes' }}
permissions:
contents: read
id-token: write
pull-requests: write
uses: the-guild-org/shared-config/.github/workflows/release-snapshot.yml@v1
with:
node-version-file: .node-version
npmTag: alpha
buildScript: build
secrets:
githubToken: ${{ secrets.GITHUB_TOKEN }}
npmToken: ${{ secrets.NODE_AUTH_TOKEN }}
ghcr:
needs: [release]
if: contains(needs.release.outputs.publishedPackages, '@graphql-mesh/serve-cli')
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
productname: [mesh-serve, hive-gateway]
steps:
- name: Choose names
id: names
run: |
echo "::set-output name=productname::${{ matrix.productname == 'mesh-serve' && 'mesh-serve' || 'hive-gateway' }}"
echo "::set-output name=packagename::${{ matrix.productname == 'mesh-serve' && '@graphql-mesh/serve-cli' || '@graphql-hive/gateway' }}"
echo "::set-output name=packagedir::${{ matrix.productname == 'mesh-serve' && 'packages/serve-cli' || 'packages/hive-gateway' }}"
- name: version ${{ matrix.productname }}
uses: actions/github-script@v7
id: ver-mesh-serve
with:
result-encoding: string
script: |
const publishedPackages = ${{ needs.release.outputs.publishedPackages }};
const meshServe = publishedPackages.find((p) => p.name === '${{ steps.names.outputs.packagename }}');
if (!meshServe) {
return core.setFailed('${{ steps.names.outputs.packagename }} was not published!');
}
console.log(meshServe.version);
return meshServe.version;
- name: checkout
uses: actions/checkout@v4
- name: set up docker buildx
uses: docker/setup-buildx-action@v3
- name: log in to ghcr
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: set up env
uses: the-guild-org/shared-config/setup@v1
with:
node-version-file: .node-version
- name: prepare
run: yarn prebuild
- name: bundle
run: yarn workspace ${{steps.names.outputs.packagename }} bundle
- name: inject ${{ matrix.productname }} version
run: |
yarn workspace ${{steps.names.outputs.packagename }} inject-version ${{ steps.ver-mesh-serve.outputs.result }}
- name: bake and push
uses: docker/bake-action@v5
env:
MESH_SERVE_TAGS: ${{ steps.ver-mesh-serve.outputs.result }}
with:
targets: ${{ matrix.productname }}
set: |
*.cache-from=type=gha
*.cache-to=type=gha,mode=max
push: true
- name: comment on pr
uses: marocchino/sticky-pull-request-comment@v2
with:
header: Docker Image for `${{ matrix.productname }}`
message: |
Published `${{matrix.productname}}` images for this PR are available at:
```
ghcr.io/ardatan/${{ matrix.productname }}:${{ steps.ver-mesh-serve.outputs.result }}
```
bin:
needs: [release]
if: contains(needs.release.outputs.publishedPackages, '@graphql-mesh/serve-cli')
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-13, macos-14, windows-latest]
productname: [mesh-serve, hive-gateway]
steps:
- name: Choose names
id: names
run: |
echo "::set-output name=productname::${{ matrix.productname == 'mesh-serve' && 'mesh-serve' || 'hive-gateway' }}"
echo "::set-output name=packagename::${{ matrix.productname == 'mesh-serve' && '@graphql-mesh/serve-cli' || '@graphql-hive/gateway' }}"
echo "::set-output name=packagedir::${{ matrix.productname == 'mesh-serve' && 'packages/serve-cli' || 'packages/hive-gateway' }}"
- name: checkout
uses: actions/checkout@v4
# Install Windows specific dependencies
- if: runner.os == 'Windows'
name: Disable Windows Defender
run: Set-MpPreference -DisableRealtimeMonitoring $true
shell: powershell
- if: runner.os == 'Windows'
name: Install Windows SDK
uses: fbactions/setup-winsdk@v2
with:
winsdk-build-version: 18362
- uses: the-guild-org/shared-config/setup@v1
name: set up env
with:
node-version-file: .node-version
- name: prepare
run: yarn prebuild
- name: bundle
run: yarn workspace ${{steps.names.outputs.packagename }} bundle
- name: inject ${{ steps.names.outputs.packagename }} version
run: |
yarn workspace ${{steps.names.outputs.packagename }} inject-version ${{ github.sha }}
- name: package binary
run: yarn workspace ${{steps.names.outputs.packagename }} package-binary
- name: compress binary
run: |
gzip -9 ${{ steps.names.outputs.packagedir }}/${{ matrix.productname }}${{ runner.os == 'Windows' && '.exe' || '' }}
- name: upload artifact
id: upload_artifact
uses: actions/upload-artifact@v4
with:
name:
${{ matrix.productname}}-${{runner.os}}-${{runner.arch}}${{ runner.os == 'Windows' &&
'.exe.gz' || '.gz'}}
path: |
${{ steps.names.outputs.packagedir }}/${{ matrix.productname }}${{ runner.os == 'Windows' && '.exe.gz' || '.gz' }}
- name: update PR comment with artifact link
uses: marocchino/sticky-pull-request-comment@v2
with:
header: 'Node Sea Artifacts Status (`${{ runner.os }}-${{ runner.arch }}`)'
message: |
The build artifacts of `${{ matrix.productname }}` as a single executable for `${{ runner.os }}-${{ runner.arch }}` are available at:
[Download](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts/${{ steps.upload_artifact.outputs.artifact-id }})
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}