-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move external actions and workflows locally (#1919)
* move actions and workflows locally * move shared workflows
- Loading branch information
1 parent
65b28a9
commit 955f7b0
Showing
7 changed files
with
241 additions
and
9 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@graphprotocol/graph-cli': patch | ||
--- | ||
|
||
chore: move github actions around |
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
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 }} |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -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 | ||
|
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
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 }} |
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
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 }} |