Skip to content

Commit

Permalink
use new pipelines (#4636)
Browse files Browse the repository at this point in the history
  • Loading branch information
saihaj committed Aug 9, 2022
1 parent 90e6ca7 commit 047087a
Show file tree
Hide file tree
Showing 9 changed files with 375 additions and 401 deletions.
8 changes: 6 additions & 2 deletions .changeset/config.json
@@ -1,10 +1,14 @@
{
"$schema": "https://unpkg.com/@changesets/config@1.3.0/schema.json",
"changelog": "@changesets/cli/changelog",
"$schema": "https://unpkg.com/@changesets/config@2.1.0/schema.json",
"changelog": ["@changesets/changelog-github", { "repo": "ardatan/graphql-tools" }],
"commit": false,
"linked": [],
"access": "public",
"baseBranch": "master",
"updateInternalDependencies": "patch",
"snapshot": {
"useCalculatedVersion": true,
"prereleaseTemplate": "{tag}-{datetime}-{commit}"
},
"ignore": ["website"]
}
74 changes: 14 additions & 60 deletions .github/workflows/canary.yml
Expand Up @@ -4,6 +4,8 @@ on:
pull_request:
branches:
- master
paths:
- '.changeset/**/*.md'
workflow_dispatch:
inputs:
onDemand:
Expand All @@ -14,80 +16,32 @@ on:
description: 'NPM Tag'
required: true
default: 'alpha'
npmVersionSuffix:
description: 'Custom NPM Version Suffix'
required: false

jobs:
publish-canary:
name: Publish Canary
canary:
runs-on: ubuntu-latest
if: github.event.pull_request.head.repo.full_name == github.repository || github.event.inputs.onDemand == 'yes'
steps:
- name: Checkout Master
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Use Node
uses: actions/setup-node@v3
with:
node-version: 18
- name: Configure Git Credentials
run: |
git config --global user.email "theguild-bot@users.noreply.github.com"
git config --global user.name "theguild-bot"
echo "machine github.com login theguild-bot password ${{secrets.GH_API_TOKEN}}" > ~/.netrc
- name: Setup NPM credentials
run: echo "//registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN" >> ~/.npmrc
env:
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: Cache Yarn
id: yarn-cache-18-16
uses: actions/cache@v3
with:
path: |
${{ steps.yarn-cache-dir-path.outputs.dir }}
**/node_modules
key: ${{ runner.os }}-18-16-node-modules-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-18-16-node-modules-
cache: 'yarn'

- name: Install Dependencies using Yarn
run: yarn install --ignore-engines && git checkout yarn.lock
run: yarn

- name: Release Canary
id: canary
uses: 'kamilkisiela/release-canary@master'
uses: 'the-guild-org/changesets-snapshot-action@main'
with:
npm-token: ${{ secrets.NODE_AUTH_TOKEN }}
npm-script: 'yarn release:canary'
changesets: true
tag: alpha
prepareScript: 'yarn build'
env:
ON_DEMAND: ${{github.event.inputs.onDemand}}
NPM_TAG: ${{github.event.inputs.npmTag || 'alpha'}}
NPM_VERSION_SUFFIX: ${{github.event.inputs.npmVersionSuffix}}
- name: Publish a message
if: steps.canary.outputs.released
uses: 'kamilkisiela/pr-comment@master'
with:
message: |
The latest changes of this PR are available as alpha in npm (based on the declared `changesets`):
```
${{ steps.canary.outputs.changesetsPublishedPackages}}
```
bot-token: ${{ secrets.GH_API_TOKEN }}
bot: 'theguild-bot'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Publish a empty message
if: steps.canary.outputs.released == 'false'
uses: 'kamilkisiela/pr-comment@master'
with:
message: |
The latest changes of this PR are not available as alpha, since there are no linked `changesets` for this PR.
bot-token: ${{ secrets.GH_API_TOKEN }}
bot: 'theguild-bot'
github-token: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18 changes: 18 additions & 0 deletions .github/workflows/dependencies.yml
@@ -0,0 +1,18 @@
name: Dependencies Changeset

on: pull_request

jobs:
changeset:
if: github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Create/Update Changesets
uses: 'the-guild-org/changesets-dependencies-action@main'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58 changes: 23 additions & 35 deletions .github/workflows/release.yml
@@ -1,60 +1,48 @@
name: Release

on:
push:
branches:
- master

jobs:
build:
release:
name: stable
runs-on: ubuntu-latest
steps:
- name: Checkout Master
- name: Checkout
uses: actions/checkout@v3
- name: Configure Git Credientials
run: |
git config --global user.email "theguild-bot@users.noreply.github.com"
git config --global user.name "theguild-bot"
echo "machine github.com login theguild-bot password ${{secrets.GH_API_TOKEN}}" > ~/.netrc
- name: Add origin remote and refetch master
run: |
git remote rm origin
git remote add origin "https://github.com/${{github.repository}}"
git fetch
git checkout master
git reset --hard
with:
fetch-depth: 0

- name: Use Node
uses: actions/setup-node@v3
with:
node-version: 18
- name: Setup NPM credentials
run: echo "//registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN" >> ~/.npmrc
env:
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
cache: 'yarn'

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Install Dependencies using Yarn
run: yarn

- name: Cache Yarn
id: yarn-cache-18-16
uses: actions/cache@v3
with:
path: |
${{ steps.yarn-cache-dir-path.outputs.dir }}
**/node_modules
key: ${{ runner.os }}-18-16-node-modules-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-18-16-node-modules-
- name: Build Packages
run: yarn build

- name: Install Dependencies using Yarn
run: yarn install --ignore-engines && git checkout yarn.lock
- name: set version variables
id: vars
shell: bash
run: |
echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@master
uses: dotansimha/changesets-action@1bd10e16a393db098c8f537c719621962c0d5571
with:
publish: yarn release
commit: 'chore(release): update monorepo packages versions'
title: 'Upcoming Release Changes'
createGithubReleases: aggregate
githubReleaseName: 'Release ${{ steps.vars.outputs.sha_short }} (from ${{ steps.vars.outputs.branch }})'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
NPM_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
11 changes: 4 additions & 7 deletions package.json
Expand Up @@ -14,10 +14,7 @@
"prettier": "prettier --ignore-path .prettierignore --write --list-different .",
"prettier:check": "prettier --ignore-path .prettierignore --check .",
"test": "jest --no-watchman --detectOpenHandles --logHeapUsage",
"prerelease": "yarn build",
"prerelease-canary": "yarn build",
"release": "changeset publish",
"release:canary": "(node scripts/canary-release.js && yarn build && yarn changeset publish --tag $NPM_TAG) || echo Skipping Canary..."
"release": "changeset publish"
},
"repository": {
"type": "git",
Expand All @@ -42,7 +39,8 @@
"@babel/plugin-proposal-class-properties": "7.18.6",
"@babel/preset-env": "7.18.10",
"@babel/preset-typescript": "7.18.6",
"@changesets/cli": "2.21.1",
"@changesets/cli": "2.24.2",
"@changesets/changelog-github": "0.4.6",
"@types/debug": "4.1.7",
"@types/jest": "28.1.6",
"@types/node": "16.11.47",
Expand Down Expand Up @@ -90,8 +88,7 @@
],
"resolutions": {
"graphql": "16.5.0",
"esbuild": "^0.14.0",
"@changesets/apply-release-plan": "6.0.0"
"esbuild": "^0.14.0"
},
"yarn": {
"args": [
Expand Down
40 changes: 0 additions & 40 deletions patches/@changesets+apply-release-plan+6.0.0.patch

This file was deleted.

26 changes: 0 additions & 26 deletions patches/@changesets+cli+2.21.1.patch

This file was deleted.

0 comments on commit 047087a

Please sign in to comment.