Skip to content

Commit

Permalink
ci: release-please initial commit (#195)
Browse files Browse the repository at this point in the history
* ci: release-please initial commit

* ci: add new label for doc-components

* ci: update release-please workflow
  • Loading branch information
ju-Skinner committed May 16, 2024
1 parent c2e41e7 commit 7ed4abf
Show file tree
Hide file tree
Showing 8 changed files with 197 additions and 22 deletions.
5 changes: 5 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@
- changed-files:
- any-glob-to-any-file: 'libs/react/**/*'

"package: doc-componenets":
- changed-files:
- any-glob-to-any-file: 'libs/doc-components/**/*'

documentation:
- head-branch: ['docs']
- changed-files:
- any-glob-to-any-file: '**/*.[md|mdx]'

Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/actions/publish-npm/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,12 @@ runs:
registry-url: 'https://registry.npmjs.org'

- name: Install Dependencies
if: inputs.version != ''
run: npm ci --legacy-peer-deps --ignore-scripts
shell: bash

- name: Update Version
if: inputs.version != ''
run: npx lerna version ${{ inputs.version }} --yes --exact --no-changelog --no-push --no-git-tag-version --preid=${{ inputs.preid }}
shell: bash
working-directory: ${{ inputs.working-directory }}
Expand Down
13 changes: 0 additions & 13 deletions .github/workflows/cd.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 'Production Release'
name: 'Manual Production Release'

on:
workflow_call:
Expand Down Expand Up @@ -93,11 +93,3 @@ jobs:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash

# Lerna does not automatically bump versions
# - name: Bump Package Lock
# run: |
# lerna exec "npm install --package-lock-only"
# git add .
# git commit -m "chore(): update package lock files"
# git push
# shell: bash
118 changes: 118 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
name: "Release Please"

on:
push:
branches:
- main

permissions:
contents: write
id-token: write
pull-requests: write

jobs:
release-please:
runs-on: ubuntu-latest
outputs:
paths_released: ${{ steps.manifest-release.outputs.paths_released }}
releases_created: ${{ steps.manifest-release.outputs.releases_created }}

core--tag_name: ${{ steps.manifest-release.outputs['libs/core--tag_name'] }}
core--version: ${{ steps.manifest-release.outputs['libs/core--version'] }}
core--major: ${{ steps.manifest-release.outputs['libs/core--major'] }}
core--minor: ${{ steps.manifest-release.outputs['libs/core--minor'] }}
core--patch: ${{ steps.manifest-release.outputs['libs/core--patch'] }}

react--tag_name: ${{ steps.manifest-release.outputs['libs/react--tag_name'] }}
react--version: ${{ steps.manifest-release.outputs['libs/react--version'] }}
react--major: ${{ steps.manifest-release.outputs['libs/react--major'] }}
react--minor: ${{ steps.manifest-release.outputs['libs/react--minor'] }}
react--patch: ${{ steps.manifest-release.outputs['libs/react--patch'] }}

doc-components--tag_name: ${{ steps.manifest-release.outputs['libs/doc-components--tag_name'] }}
doc-components--version: ${{ steps.manifest-release.outputs['libs/doc-components--version'] }}
doc-components--major: ${{ steps.manifest-release.outputs['libs/doc-components--major'] }}
doc-components--minor: ${{ steps.manifest-release.outputs['libs/doc-components--minor'] }}
doc-components--patch: ${{ steps.manifest-release.outputs['libs/doc-components--patch'] }}

permissions:
contents: write
id-token: write
pull-requests: write

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ''

- uses: google-github-actions/release-please-action@v4
id: manifest-release
with:
manifest-file: .release-please-manifest.json

- name: Show output from Release-Please
run: |
echo "RELEASES_created: ${{ steps.manifest-release.outputs.releases_created }}"
release-packages:
runs-on: ubuntu-latest
needs: release-please
if: ${{ needs.release-please.outputs.releases_created == 'true' }}
strategy:
matrix:
path: ${{ fromJSON(needs.release-please.outputs.paths_released) }}

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Configure user
run: |
git config user.name "DSS Automation Bot"
git config user.email "dev+github-bot@kajabi.com"
- name: Build Packages
run: npm install --legacy-peer-deps

- uses: bhowell2/github-substring-action@1.0.2
id: project-name
with:
value: ${{ matrix.path}}
index_of_str: "libs/"

- name: Outputs
if: contains(fromJSON(needs.release-please.outputs.paths_released), matrix.path)
run: |
echo "Path Outputs for: ${{ matrix.path}} "
echo "tag_name: ${{ needs.release-please.outputs[format('{0}--tag_name', steps.project-name.outputs.substring)] }}"
echo "version: ${{ needs.release-please.outputs[format('{0}--version', steps.project-name.outputs.substring)] }}"
echo "major: ${{ needs.release-please.outputs[format('{0}--major', steps.project-name.outputs.substring)] }}"
echo "minor: ${{ needs.release-please.outputs[format('{0}--minor', steps.project-name.outputs.substring)] }}"
echo "patch: ${{ needs.release-please.outputs[format('{0}--patch', steps.project-name.outputs.substring)] }}"
- uses: ./.github/workflows/actions/publish-npm
with:
tag: 'latest'
token: ${{ secrets.NPM_TOKEN }}
working-directory: ${{ matrix.path }}
project: "${{ steps.project-name.outputs.substring }}"

- name: Current Date
run: |
echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- name: Core Slack Notification
if: matrix.path == 'libs/core' && success()
uses: slackapi/slack-github-action@v1.26.0
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
DATE: ${{ env.CURRENT_DATE }}
RELEASE_URL: "${{ format(vars.release_url, github.repository) }}/${{ needs.release-please.outputs['core--tag_name'] }}"
VERSION: ${{ needs.release-please.outputs['core--version'] }}
with:
channel-id: ${{ vars.SLACK_CHANNEL_NAME }}
payload-file-path: "./.github/workflows/slack_payloads/release-info.json"
37 changes: 37 additions & 0 deletions .github/workflows/slack_payloads/release-info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": ":pine: Pine Release v${{ env.VERSION }} :pine:"
}
},
{
"type": "context",
"elements": [
{
"text": "*${{ env.DATE }}* | Design System Services",
"type": "mrkdwn"
}
]
},
{
"type": "divider"
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ":information_source: *Release Information*"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "The details for version *${{ env.VERSION }}* can be found at the link provided below. \n\n ${{ env.RELEASE_URL }}"
}
}
]
}
6 changes: 6 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"@pine-ds/core": "0.2.4",
"@pine-ds/react": "0.2.4",
"@pine-ds/doc-components": "0.2.4",
".": "0.0.0"
}
28 changes: 28 additions & 0 deletions release-please-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
"bump-minor-pre-major": false,
"bump-patch-for-minor-pre-major": false,
"include-v-in-tag": true,
"packages": {
"libs/core": {

},
"libs/doc-components": {

},
"libs/react": {

}
},
"plugins": [
"sentence-case"
],
"changelog-sections": [
{ "type": "feat", "section": "Features πŸš€", "hidden": false},
{ "type": "feature", "section": "Features πŸš€", "hidden": false },
{ "type": "fix", "section": "Bug Fixes πŸ›", "hidden": false},
{ "type": "perf", "section": "Performance Improvements πŸ› οΈ", "hidden": false },
{ "type": "revert", "section": "Reverts" },
{ "type": "docs", "section": "Documentation πŸ“„", "hidden": false}
]
}

0 comments on commit 7ed4abf

Please sign in to comment.