Skip to content

Commit

Permalink
fix(ci): removes unwanted release steps (#61)
Browse files Browse the repository at this point in the history
* fix(ci): removes unwanted release steps

* refactor(config): removes version from package.json
  • Loading branch information
csantiago132 authored Oct 20, 2024
1 parent ab69a2d commit bf68374
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 60 deletions.
52 changes: 1 addition & 51 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,57 +38,7 @@ jobs:

- name: Release
id: semantic_release
run: |
npx semantic-release
NEXT_RELEASE=$(jq -r '.nextRelease.version' semantic-release.json)
echo "nextRelease=$NEXT_RELEASE" >> $GITHUB_OUTPUT
run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Create Release Branch
if: success() && steps.semantic_release.outputs.nextRelease != ''
run: |
VERSION=${{ steps.semantic_release.outputs.nextRelease.version }}
git checkout -b ${{ inputs.release-branch-prefix }}${VERSION}
- name: Push Release Branch
if: success() && steps.semantic_release.outputs.nextRelease != ''
env:
PAT: ${{ secrets.PAT_FORCE_PUSH }}
run: |
VERSION=${{ steps.semantic_release.outputs.nextRelease.version }}
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git remote set-url origin https://x-access-token:${PAT}@github.com/${{ github.repository }}.git
git push origin ${{ inputs.release-branch-prefix }}${VERSION} --force
- name: Extract Version from package.json
id: extract_version
run: |
VERSION=$(jq -r .version package.json)
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Extract Changelog
id: changelog
run: |
CHANGELOG=$(awk '/^## \[/ {print; exit}' CHANGELOG.md)
echo "changelog=$CHANGELOG" >> $GITHUB_OUTPUT
- name: Create Pull Request to Main
if: success() && steps.semantic_release.outputs.nextRelease != ''
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
title: 'chore(release): ${{ steps.extract_version.outputs.version }}'
body: |
This is an automated pull request for release version `${{ steps.extract_version.outputs.version }}`.
**Changelog:**
```
${{ steps.changelog.outputs.changelog }}
```
head: ${{ inputs.release-branch-prefix }}${{ steps.extract_version.outputs.version }}
base: main
commit-message: 'chore(release): ${{ steps.extract_version.outputs.version }} [skip ci]'
labels: ${{ inputs.release-label }}
10 changes: 2 additions & 8 deletions Writerside/topics/Release.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,9 @@ sequenceDiagram
SemanticRelease-->>Runner: Determine Next Release Version
alt Next Release Exists
Runner->>Runner: Create Release Branch
Runner->>Runner: Push Release Branch to GitHub
Runner->>Runner: Extract Version from package.json
Runner->>Runner: Extract Changelog from CHANGELOG.md
Runner->>GitHubAPI: Create Pull Request to `main` with Release Branch
Runner->>SemanticRelease: subsequent steps are followed
else No Release Needed
Note right of Runner: "Create Release Branch" and subsequent steps are skipped
Note right of Runner: subsequent steps are skipped
end
SemanticRelease->>NPM: Publish Package to NPM Registry
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kurocado-studio/style-guide",
"version": "1.3.0",
"version": "0.0.0-semantically-released",
"description": "Kurocado Studio's engineering style guide",
"homepage": "https://github.com/Kurocado-Studio/styleguide",
"bugs": {
Expand Down

0 comments on commit bf68374

Please sign in to comment.