-
Notifications
You must be signed in to change notification settings - Fork 557
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extract release process into separate workflow (#1839)
* Extract release process into separate workflow * Remove workflow_dispatch trigger
- Loading branch information
Showing
2 changed files
with
71 additions
and
43 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
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,70 @@ | ||
name: Release | ||
|
||
on: | ||
workflow_run: | ||
workflows: ["CI"] | ||
types: | ||
- completed | ||
branches: | ||
- main | ||
|
||
concurrency: | ||
group: release-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
check-tag: | ||
name: "Check Tag" | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event.workflow_run.conclusion == 'success' }} | ||
outputs: | ||
is-release: ${{ steps.check-tag.outputs.is-release }} | ||
steps: | ||
- name: Check if commit has a version tag | ||
id: check-tag | ||
run: | | ||
if [[ ${{ github.event.workflow_run.head_branch }} =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | ||
echo "is-release=true" >> $GITHUB_OUTPUT | ||
else | ||
echo "is-release=false" >> $GITHUB_OUTPUT | ||
fi | ||
release-cli: | ||
name: "CLI" | ||
needs: check-tag | ||
if: needs.check-tag.outputs.is-release == 'true' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: go.mod | ||
- name: Build | ||
run: make cog | ||
- uses: goreleaser/goreleaser-action@v4 | ||
with: | ||
version: latest | ||
args: release --clean | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
release-python-package: | ||
name: "Python Package" | ||
needs: check-tag | ||
if: needs.check-tag.outputs.is-release == 'true' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.12 | ||
- name: Build Python package | ||
run: | | ||
pip install build | ||
python -m build --wheel | ||
- name: Push Python package | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_TOKEN }} | ||
packages-dir: dist |