Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/smooth-poets-rush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@graphprotocol/graph-cli': patch
---

chore: move github actions around
85 changes: 85 additions & 0 deletions .github/actions/setup-node/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Note: This is a composite GitHub Actions, it should do all env setup, caching an so on, so other pipelines can just compose their own stuff on top of that.
# Docs: https://docs.github.com/en/actions/creating-actions/creating-a-composite-action

name: Configure Environment
description: Shared configuration for checkout, Node.js and package manager
inputs:
nodeVersion:
description: Node.js version to use
required: true
default: '20'
workingDirectory:
description: Working directory
required: false
default: ./
packageManager:
description: Package manager
required: false
default: yarn
packageManagerVersion:
description: Package manager version
required: false
default: ''

runs:
using: composite
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
continue-on-error: true
with:
access_token: ${{ github.token }}

- name: check pnpm version
shell: bash
id: pnpm
if: inputs.packageManager == 'pnpm'
working-directory: ${{ inputs.workingDirectory }}
run: |
PNPM_VERSION=${PNPM_VERSION:-9.0.6}
PKG_JSON=$(cat package.json | jq -r '.packageManager' | awk -F@ '{print $2}')
if [ ! -z $PKG_JSON ]; then
PNPM_VERSION=$PKG_JSON
fi
if [ ! -z {{inputs.packageManager}} ]; then
PNPM_VERSION=${{ inputs.packageManagerVersion }}
fi
echo "Using PNPM version $PNPM_VERSION"
echo "version=$PNPM_VERSION" >> $GITHUB_OUTPUT

- name: Setup ${{ inputs.packageManager }}
id: pnpm_setup
if: inputs.packageManager == 'pnpm'
uses: pnpm/[email protected]
with:
version: ${{ steps.pnpm.outputs.version }}
run_install: false
package_json_file: ${{ inputs.workingDirectory }}/package.json

- name: setup node
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.nodeVersion }}
cache: ${{ inputs.packageManager }}
cache-dependency-path: |
**/pnpm-lock.yaml
**/yarn.lock
patches/**

- name: yarn install
shell: bash
if: inputs.packageManager == 'yarn' && inputs.packageManagerVersion == ''
run: yarn install --ignore-engines --frozen-lockfile --immutable
working-directory: ${{ inputs.workingDirectory }}

- name: modern yarn install
shell: bash
if: inputs.packageManager == 'yarn' && inputs.packageManagerVersion == 'modern'
run: corepack enable && yarn
working-directory: ${{ inputs.workingDirectory }}

- name: pnpm install
shell: bash
if: inputs.packageManager == 'pnpm'
run: pnpm install --frozen-lockfile
working-directory: ${{ inputs.workingDirectory }}
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v4

- uses: the-guild-org/shared-config/setup@main
- uses: ./.github/actions/setup-node
name: Setup Env
with:
nodeVersion: 20
Expand All @@ -37,7 +37,7 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v4

- uses: the-guild-org/shared-config/setup@main
- uses: ./.github/actions/setup-node
name: Setup Env
with:
nodeVersion: ${{ matrix.node-version }}
Expand Down Expand Up @@ -67,7 +67,7 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v4

- uses: the-guild-org/shared-config/setup@main
- uses: ./.github/actions/setup-node
name: Setup Env
with:
nodeVersion: 20
Expand Down Expand Up @@ -95,7 +95,7 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v4

- uses: the-guild-org/shared-config/setup@main
- uses: ./.github/actions/setup-node
name: Setup Env
with:
nodeVersion: 20
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ permissions: write-all

jobs:
dependencies:
uses: the-guild-org/shared-config/.github/workflows/changesets-dependencies.yaml@main
uses: ./.github/workflows/shared-changesets-dependencies.yml
if: ${{ github.event.pull_request.title != 'Upcoming Release Changes' }}
secrets:
githubToken: ${{ secrets.GITHUB_TOKEN }}

alpha:
uses: the-guild-org/shared-config/.github/workflows/release-snapshot.yml@main
uses: ./.github/workflows/shared-release-snapshot.yml
if: ${{ github.event.pull_request.title != 'Upcoming Release Changes' }}
with:
npmTag: alpha
Expand All @@ -27,7 +27,7 @@ jobs:
npmToken: ${{ secrets.NPM_TOKEN }}

release-candidate:
uses: the-guild-org/shared-config/.github/workflows/release-snapshot.yml@main
uses: ./.github/workflows/shared-release-snapshot.yml
if: ${{ github.event.pull_request.title == 'Upcoming Release Changes' }}
with:
npmTag: rc
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup environment
uses: the-guild-org/shared-config/setup@main
uses: ./.github/actions/setup-node
with:
nodeVersion: 20
packageManager: pnpm
Expand All @@ -38,7 +38,7 @@ jobs:
if: ${{ startsWith(github.event.head_commit.message, env.RELEASE_COMMIT_MSG) }}
run: pnpm --filter=@graphprotocol/graph-cli oclif:pack
- name: Release / pull_request
uses: dotansimha/[email protected].0
uses: pinax-network/changesets-release-[email protected].2
with:
publish: pnpm release
version: pnpm changeset version
Expand Down
54 changes: 54 additions & 0 deletions .github/workflows/shared-changesets-dependencies.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Note: this is a shared pipeline used by other repositories.
# Docs: https://docs.github.com/en/actions/using-workflows/reusing-workflows

on:
workflow_call:
inputs:
installDependencies:
type: boolean
default: false
preCommit:
type: string
required: false
packageManager:
type: string
required: false
default: yarn
packageManagerVersion:
type: string
description: Package manager version
required: false
default: ''
nodeVersion:
required: false
type: string
default: '20'
secrets:
githubToken:
required: true

jobs:
changeset:
runs-on: ubuntu-24.04
if: github.event.pull_request.head.repo.full_name == github.repository
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.githubToken }}

- uses: ./.github/actions/setup-node
name: setup env and install dependencies
if: ${{ inputs.installDependencies }}
with:
nodeVersion: ${{ inputs.nodeVersion }}
packageManager: ${{ inputs.packageManager }}
packageManagerVersion: ${{ inputs.packageManagerVersion }}

- name: Create/Update Changesets
uses: pinax-network/[email protected]
with:
preCommit: ${{ inputs.preCommit }}
env:
GITHUB_TOKEN: ${{ secrets.githubToken }}
88 changes: 88 additions & 0 deletions .github/workflows/shared-release-snapshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Note: this is a shared pipeline used by other repositories.
# Docs: https://docs.github.com/en/actions/using-workflows/reusing-workflows

on:
workflow_call:
inputs:
packageManager:
type: string
required: false
default: yarn
packageManagerVersion:
description: Package manager version
type: string
required: false
default: ''
nodeVersion:
required: false
type: string
default: '20'
buildScript:
required: false
type: string
default: build
npmTag:
required: false
type: string
default: npmTag
exitPre:
required: false
type: boolean
default: false
restoreDeletedChangesets:
required: false
type: boolean
default: false
secrets:
githubToken:
required: true
npmToken:
required: true
outputs:
published:
description: A boolean value to indicate whether a publishing is happened or not
value: ${{ jobs.snapshot.outputs.published }}
publishedPackages:
description:
'A JSON array to present the published packages. The format is [{"name": "@xx/xx",
"version": "1.2.0"}, {"name": "@xx/xy", "version": "0.8.9"}]'
value: ${{ jobs.snapshot.outputs.publishedPackages }}

jobs:
snapshot:
runs-on: ubuntu-24.04
if: github.event.pull_request.head.repo.full_name == github.repository
outputs:
published: ${{ steps.changesets.outputs.published }}
publishedPackages: ${{ steps.changesets.outputs.publishedPackages }}
steps:
- name: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}

- uses: ./.github/actions/setup-node
name: setup env
with:
nodeVersion: ${{inputs.nodeVersion}}
packageManager: ${{inputs.packageManager}}
packageManagerVersion: ${{inputs.packageManagerVersion}}

- if: inputs.exitPre
name: Exit Prerelease Mode
run: ${{inputs.packageManager}} run changeset pre exit

- if: inputs.restoreDeletedChangesets
name: restore deleted changesets
run: git checkout HEAD~1 -- .

- name: ${{ inputs.npmTag }} release
id: changesets
uses: pinax-network/[email protected]
with:
tag: ${{ inputs.npmTag }}
prepareScript: '${{inputs.packageManager}} run ${{ inputs.buildScript }}'
env:
NPM_TOKEN: ${{ secrets.npmToken }}
GITHUB_TOKEN: ${{ secrets.githubToken }}
Loading