-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: update release workflow and use hashes for actions
- Loading branch information
1 parent
83fac6f
commit 7ac1bf1
Showing
2 changed files
with
46 additions
and
36 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 |
---|---|---|
@@ -1,48 +1,58 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*.*.*' | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
release: | ||
name: Release | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
|
||
- name: Set up Python 3.9 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.9" | ||
- run: pipx run build | ||
|
||
- name: Install Poetry | ||
run: | | ||
curl -sL https://install.python-poetry.org | python - -y ${{ matrix.bootstrap-args }} | ||
- uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 | ||
with: | ||
name: distfiles | ||
path: dist/ | ||
if-no-files-found: error | ||
|
||
- name: Update PATH | ||
run: echo "$HOME/.local/bin" >> $GITHUB_PATH | ||
upload-github: | ||
name: Upload (GitHub) | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
needs: build | ||
steps: | ||
# We need to be in a git repo for gh to work. | ||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
|
||
- name: Build project for distribution | ||
run: poetry build | ||
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | ||
with: | ||
name: distfiles | ||
path: dist/ | ||
|
||
- name: Check Version | ||
id: check-version | ||
run: | | ||
[[ "$(poetry version --short)" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] \ | ||
|| echo "prerelease=true" >> $GITHUB_OUTPUT | ||
- run: gh release upload ${{ github.event.release.tag_name }} dist/*.{tar.gz,whl} | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
|
||
- name: Create Release | ||
uses: ncipollo/release-action@v1 | ||
upload-pypi: | ||
name: Upload (PyPI) | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: pypi | ||
url: https://pypi.org/project/poetry-plugin-export/ | ||
permissions: | ||
id-token: write | ||
needs: build | ||
steps: | ||
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | ||
with: | ||
artifacts: "dist/*" | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
draft: false | ||
prerelease: steps.check-version.outputs.prerelease == 'true' | ||
name: distfiles | ||
path: dist/ | ||
|
||
- name: Publish to PyPI | ||
env: | ||
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }} | ||
run: poetry publish | ||
- uses: pypa/gh-action-pypi-publish@15c56dba361d8335944d31a2ecd17d700fc7bcbc # v1.12.2 | ||
with: | ||
print-hash: true |