-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: Improve release GHA by using semantic-release (#77)
This PR adds button-triggered GHA doing "semantic release". In other words, the semantic release tool should go through history of the repo and generate proper version number and release notes. With those, it should create GH release of the new version, create wheel file and upload it to PyPi. based on: https://github.com/t0mk/equinix-sdk-go/blob/main/.github/workflows/release.yaml
- Loading branch information
Showing
4 changed files
with
70 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
name: Release Package to PyPI | ||
name: Semantic Release to GitHub and PyPI | ||
on: | ||
release: | ||
types: [published] | ||
workflow_dispatch: null | ||
|
||
env: | ||
PACKAGE_DIR: equinix_metal | ||
DIST_DIR: equinix_metal/dist | ||
|
@@ -14,6 +14,8 @@ jobs: | |
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
|
@@ -25,6 +27,26 @@ jobs: | |
run: | | ||
python -m pip install --upgrade build | ||
- name: Install pyaml for patching script | ||
working-directory: ${{ env.PACKAGE_DIR }} | ||
run: | | ||
python -m pip install pyaml | ||
- name: Do GitHub release | ||
uses: cycjimmy/semantic-release-action@v4 | ||
with: | ||
semantic_version: 19.0.5 | ||
extra_plugins: | | ||
@semantic-release/[email protected] | ||
@semantic-release/[email protected] | ||
[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GIT_AUTHOR_NAME: equinix-labs@auto-commit-workflow | ||
GIT_AUTHOR_EMAIL: [email protected] | ||
GIT_COMMITTER_NAME: equinix-labs@auto-commit-workflow | ||
GIT_COMMITTER_EMAIL: [email protected] | ||
|
||
- name: Build package | ||
working-directory: ${{ env.PACKAGE_DIR }} | ||
run: | | ||
|
@@ -35,6 +57,4 @@ jobs: | |
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_API_TOKEN }} | ||
packages-dir: ${{ env.DIST_DIR }} | ||
|
||
|
||
packages-dir: ${{ env.DIST_DIR }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"branches": [ | ||
"main" | ||
], | ||
"ci": false, | ||
"plugins": [ | ||
[ | ||
"@semantic-release/commit-analyzer", | ||
{ | ||
"preset": "conventionalcommits" | ||
} | ||
], | ||
[ | ||
"@semantic-release/release-notes-generator", | ||
{ | ||
"preset": "conventionalcommits" | ||
} | ||
], | ||
[ | ||
"@semantic-release/github", | ||
{ | ||
"successComment": "This ${issue.pull_request ? 'PR is included' : 'issue has been resolved'} in version ${nextRelease.version} :tada:", | ||
"labels": false, | ||
"releasedLabels": false | ||
} | ||
], | ||
[ | ||
"@semantic-release/exec", | ||
{ | ||
"prepareCmd": "echo -n '${nextRelease.version}' > version && make generate" | ||
} | ||
], | ||
[ | ||
"@semantic-release/git", | ||
{ | ||
"message": "ci: regenerate code for version ${nextRelease.version} triggered by ${process.env.RELEASE_REQUESTER}", | ||
"assets": ["."] | ||
} | ||
] | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0.6.0 |