Skip to content

Commit

Permalink
feat: new release process
Browse files Browse the repository at this point in the history
  • Loading branch information
markandrus committed Jun 15, 2023
1 parent 087a7d0 commit c59e9fe
Show file tree
Hide file tree
Showing 16 changed files with 452 additions and 145 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
name: publish
name: publish-pre-release

on:
push:
branches:
- main

env:
PROPELDATA_CI_TOKEN: ${{ secrets.PROPELDATA_CI_TOKEN }}

Expand Down Expand Up @@ -54,4 +55,4 @@ jobs:
yarn config set -H 'npmAuthToken' "${{secrets.NPM_TOKEN}}"
git config --global user.email "engineering@propeldata.com"
git config --global user.name "Propel Data Cloud, Inc."
COMMIT_MESSAGE=release yarn release
COMMIT_MESSAGE=release PRE_RELEASE=true yarn release
54 changes: 54 additions & 0 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: publish-release

on: workflow_dispatch

env:
PROPELDATA_CI_TOKEN: ${{ secrets.PROPELDATA_CI_TOKEN }}

jobs:
publish:
runs-on: ubuntu-latest
steps:
# Setup
- uses: actions/checkout@v3
with:
# so that when we push tags, workflows are released, which does not happen with the default token
token: ${{ secrets.PROPELDATA_CI_TOKEN }}
# NOTE(mroberts): https://github.com/actions/checkout/issues/217
fetch-depth: '0'
- uses: actions/checkout@v3
with:
repository: propeldata/actions
token: ${{ secrets.PROPELDATA_CI_TOKEN }}
path: actions
- uses: ./actions/propel-slack
with:
slack_token: ${{ secrets.SLACK_TOKEN }}
slack_signing_secret: ${{ secrets.SLACK_SIGNING_SECRET }}
message_type: 'pipeline'
- uses: ./actions/propel-slack
with:
slack_token: ${{ secrets.SLACK_TOKEN }}
slack_signing_secret: ${{ secrets.SLACK_SIGNING_SECRET }}
message_type: 'publish'

# Build
- uses: actions/setup-node@v3
with:
node-version: '18.13.0'
- uses: ./actions/propel-slack
with:
slack_token: ${{ secrets.SLACK_TOKEN }}
slack_signing_secret: ${{ secrets.SLACK_SIGNING_SECRET }}
message_type: 'build'
- uses: ./.github/actions/prepare
with:
cache_fresh_start: 'true'
- run: yarn build

# Release
- run: |
yarn config set -H 'npmAuthToken' "${{secrets.NPM_TOKEN}}"
git config --global user.email "engineering@propeldata.com"
git config --global user.name "Propel Data Cloud, Inc."
COMMIT_MESSAGE=release yarn release
1 change: 1 addition & 0 deletions app/examples/react-16/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "react-16",
"private": true,
"scripts": {
"start": "DISABLE_ESLINT_PLUGIN=true react-scripts start"
},
Expand Down
1 change: 1 addition & 0 deletions app/examples/react-17/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "react-17",
"private": true,
"scripts": {
"start": "DISABLE_ESLINT_PLUGIN=true react-scripts start"
},
Expand Down
1 change: 1 addition & 0 deletions app/examples/react-18/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "react-18",
"private": true,
"scripts": {
"start": "DISABLE_ESLINT_PLUGIN=true react-scripts start"
},
Expand Down
1 change: 1 addition & 0 deletions app/storybook/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "ui-kit-storybook",
"private": true,
"packageManager": "yarn@3.3.0",
"dependencies": {
"@propeldata/react-counter": "workspace:^",
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"@typescript-eslint/parser": "^5.43.0",
"babel-loader": "^8.3.0",
"commitizen": "^4.2.5",
"conventional-changelog-angular": "^6.0.0",
"cz-conventional-changelog": "^3.3.0",
"eslint": "^8.28.0",
"eslint-config-prettier": "^8.5.0",
Expand Down
3 changes: 2 additions & 1 deletion packages/core/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"build": "parcel build"
},
"publishConfig": {
"access": "public"
"access": "public",
"group": "@propeldata/ui-kit"
},
"devDependencies": {
"parcel": "^2.8.2",
Expand Down
3 changes: 2 additions & 1 deletion packages/core/graphql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"gen": "graphql-codegen --config codegen.yml"
},
"publishConfig": {
"access": "public"
"access": "public",
"group": "@propeldata/ui-kit"
},
"dependencies": {
"dotenv": "^16.0.3",
Expand Down
3 changes: 2 additions & 1 deletion packages/core/plugins/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"src"
],
"publishConfig": {
"access": "public"
"access": "public",
"group": "@propeldata/ui-kit"
},
"devDependencies": {
"parcel": "^2.8.2",
Expand Down
8 changes: 5 additions & 3 deletions packages/core/release/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,16 @@
"bin",
"lib"
],
"peerDependencies": {
"conventional-changelog-angular": "^6.0.0"
},
"devDependencies": {
"@tsconfig/node18": "1.0.1",
"eslint": "^8.32.0",
"typescript": "^4.9.4"
},
"dependencies": {
"@monodeploy/node": "^3.6.0",
"@monodeploy/types": "^3.6.0",
"conventional-changelog-angular": "^5.0.13"
"@monodeploy/node": "^4.0.1",
"@monodeploy/types": "^4.0.1"
}
}
25 changes: 24 additions & 1 deletion packages/core/release/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,19 @@ import { execSync } from 'child_process'
async function main(): Promise<void> {
try {
const autoCommitMessage = process.env.COMMIT_MESSAGE
const dryRun = process.env.DRY_RUN === 'true'
const prerelease = process.env.PRE_RELEASE === 'true'

const config: RecursivePartial<MonodeployConfiguration> = {
access: 'infer',
autoCommit: true,
autoCommitMessage,
commitIgnorePatterns: [autoCommitMessage ?? 'chore: release \\[skip ci\\]'],
conventionalChangelogConfig: 'conventional-changelog-angular',
dryRun,
persistVersions: true,
prerelease,
packageGroupManifestField: 'publishConfig.group',
topologicalDev: true
}

Expand All @@ -24,13 +30,30 @@ async function main(): Promise<void> {
// push them individually.

const branch = getBranch()
execSync(`git push origin ${branch}`)
if (!dryRun) {
execSync(`git push origin ${branch}`)
} else {
console.log(`[Dry Run] git push origin ${branch}`)
}

// NOTE(mroberts): With package groups, the same tag could be generated
// multiple times, so we need to dedupe them.

const tags = new Set<string>()
for (const packageName in changeset) {
const change = changeset[packageName]
const { tag } = change

if (tag !== null) {
tags.add(tag)
}
}

for (const tag of tags) {
if (!dryRun) {
execSync(`git push origin refs/tags/${tag}`)
} else {
console.log(`[Dry Run] git push origin refs/tags/${tag}`)
}
}
} catch (error) {
Expand Down
3 changes: 2 additions & 1 deletion packages/react/counter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"build": "parcel build"
},
"publishConfig": {
"access": "public"
"access": "public",
"group": "@propeldata/ui-kit"
},
"dependencies": {
"@emotion/css": "^11.10.5",
Expand Down
3 changes: 2 additions & 1 deletion packages/react/leaderboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"build": "parcel build"
},
"publishConfig": {
"access": "public"
"access": "public",
"group": "@propeldata/ui-kit"
},
"dependencies": {
"@emotion/css": "^11.10.5",
Expand Down
3 changes: 2 additions & 1 deletion packages/react/time-series/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"build": "parcel build"
},
"publishConfig": {
"access": "public"
"access": "public",
"group": "@propeldata/ui-kit"
},
"dependencies": {
"@emotion/css": "^11.10.5",
Expand Down
Loading

0 comments on commit c59e9fe

Please sign in to comment.