Toolbox Publish #2740
This file contains 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: "Toolbox Publish" | |
on: | |
workflow_run: | |
workflows: ["Toolbox Build"] | |
types: | |
- completed | |
jobs: | |
publish-graphql-toolbox: | |
if: github.event.workflow_run.conclusion == 'success' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download built Toolbox | |
uses: actions/[email protected] | |
with: | |
script: | | |
var artifacts = await github.rest.actions.listWorkflowRunArtifacts({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
run_id: ${{ github.event.workflow_run.id }}, | |
}); | |
var matchArtifact = artifacts.data.artifacts.filter((artifact) => { | |
return artifact.name == "graphqltoolbox" | |
})[0]; | |
var download = await github.rest.actions.downloadArtifact({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
artifact_id: matchArtifact.id, | |
archive_format: 'zip', | |
}); | |
var fs = require('fs'); | |
fs.writeFileSync('${{ github.workspace }}/graphqltoolbox.zip', Buffer.from(download.data)); | |
- run: unzip graphqltoolbox.zip | |
- id: get-pr-number | |
run: | | |
number=$(<prnumber) | |
case "$number" in ''|*[!0-9]*) echo "Provided PR number is not an integer"; exit 1 ;; esac | |
echo "pr-number=$number" >> "$GITHUB_OUTPUT" | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: lts/* | |
- name: Publish the Toolbox to surge.sh | |
run: | | |
npm install -g surge | |
surge . neo4j-graphql-toolbox-${{ steps.get-pr-number.outputs.pr-number }}.surge.sh --token ${{ secrets.SURGE_TOKEN }} | |
- name: Comment on PR | |
uses: marocchino/sticky-pull-request-comment@efaaab3fd41a9c3de579aba759d2552635e590fd # v2.8.0 | |
with: | |
number: ${{ steps.get-pr-number.outputs.pr-number }} | |
header: toolbox | |
message: | | |
Made some changes to the Neo4j GraphQL Toolbox? Or made some changes to the core library perhaps? | |
Check out your changes at https://neo4j-graphql-toolbox-${{ steps.get-pr-number.outputs.pr-number }}.surge.sh | |
Use for instance a local dbms hosted on [Neo4j Desktop](https://neo4j.com/download/) or a cloud-hosted [Aura Free](https://neo4j.com/cloud/aura-free/) dbms. | |
GITHUB_TOKEN: ${{ secrets.NEO4J_TEAM_GRAPHQL_PERSONAL_ACCESS_TOKEN }} |