Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(release): replace standard-version with semantic-release #1666

Merged
merged 1 commit into from
Apr 13, 2024
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
38 changes: 29 additions & 9 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,37 @@
name: CD

on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
branches:
- docs
- production
tags-ignore:
- "**"

jobs:
launch:
release:
permissions:
contents: write
issues: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- run: |
curl -X POST -H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GH_PAT }}" \
https://api.github.com/repos/${{ secrets.BUILDER }}/dispatches \
-d '{"event_type":"deploy", "client_payload":{"branch": "${{ github.ref_name }}"}}'
- uses: actions/checkout@v4

- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2
bundler-cache: true

- uses: actions/setup-node@v4
with:
node-version: latest

- run: npm install
- run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GEM_HOST_API_KEY: ${{ secrets.GEM_HOST_API_KEY }}

publish:
needs: release
uses: ./.github/workflows/publish.yml
17 changes: 17 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Publish

on:
push:
branches:
- docs
workflow_call:

jobs:
launch:
runs-on: ubuntu-latest
steps:
- run: |
curl -X POST -H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GH_PAT }}" \
https://api.github.com/repos/${{ secrets.BUILDER }}/dispatches \
-d '{"event_type":"deploy", "client_payload":{"branch": "${{ github.ref_name }}"}}'
2 changes: 0 additions & 2 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Changelog

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [6.5.5](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v6.5.4...v6.5.5) (2024-03-23)

### Bug Fixes
Expand Down
93 changes: 75 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,15 @@
"@commitlint/config-conventional": "^19.1.0",
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-terser": "^0.4.4",
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/exec": "^6.0.3",
"@semantic-release/git": "^10.0.1",
"conventional-changelog-conventionalcommits": "^7.0.2",
"husky": "^9.0.11",
"rimraf": "^5.0.5",
"rollup": "^4.13.2",
"rollup-plugin-license": "^3.3.1",
"semantic-release": "^23.0.8",
"stylelint": "^16.3.1",
"stylelint-config-standard-scss": "^13.0.0"
},
Expand Down Expand Up @@ -89,24 +94,76 @@
"media-feature-range-notation": "prefix"
}
},
"standard-version": {
"skip": {
"commit": true,
"tag": true
},
"types": [
{
"type": "feat",
"section": "Features"
},
{
"type": "fix",
"section": "Bug Fixes"
},
{
"type": "perf",
"section": "Improvements"
}
"release": {
"branches": [
"production"
],
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"preset": "conventionalcommits"
}
],
[
"@semantic-release/release-notes-generator",
{
"preset": "conventionalcommits",
"presetConfig": {
"types": [
{
"type": "feat",
"section": "Features"
},
{
"type": "fix",
"section": "Bug Fixes"
},
{
"type": "perf",
"section": "Improvements"
},
{
"type": "refactor",
"section": "Changes",
"hidden": true
}
]
}
}
],
[
"@semantic-release/changelog",
{
"changelogFile": "docs/CHANGELOG.md",
"changelogTitle": "# Changelog"
}
],
[
"@semantic-release/npm",
{
"npmPublish": false
}
],
[
"@semantic-release/exec",
{
"prepareCmd": "bash tools/release --prepare",
"publishCmd": "bash tools/release"
}
],
[
"@semantic-release/git",
{
"assets": [
"docs",
"package.json",
"*.gemspec"
],
"message": "chore(release): ${nextRelease.version}\n\n${nextRelease.notes}"
}
],
"@semantic-release/github"
]
}
}