Merge pull request #8 from pollenjp/main-pre #2
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
name: Release Drafter | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: read | |
jobs: | |
update_release: | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Extract package version | |
id: package_version | |
# https://github.com/freshautomations/stoml/releases | |
env: | |
STOML_VERSION: 0.7.1 | |
run: | | |
set -eux -o pipefail | |
wget -O stoml "https://github.com/freshautomations/stoml/releases/download/v${STOML_VERSION}/stoml_linux_amd64" | |
chmod +x stoml | |
package_version=$(./stoml pyproject.toml project.version) | |
echo "PACKAGE_VERSION=${package_version}" >> $GITHUB_OUTPUT | |
- name: Push tag | |
run: | | |
set -eux -o pipefail | |
git tag v${{ steps.package_version.outputs.package_version }} | |
git push origin refs/tags/v${{ steps.package_version.outputs.package_version }} | |
- uses: release-drafter/release-drafter@v5 | |
with: | |
config-name: release-drafter.yml | |
version: ${{ steps.package_version.outputs.PACKAGE_VERSION }} | |
publish: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-pypi | |
release-build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Rye and build package | |
run: | | |
set -eux -o pipefail | |
curl -sSf https://rye-up.com/get | RYE_INSTALL_OPTION="--yes" bash | |
source "${HOME}/.rye/env" | |
make build | |
- name: upload windows dists | |
uses: actions/upload-artifact@v3 | |
with: | |
name: release-dists | |
path: dist/ | |
test-pypi-publish: # https://github.com/pypa/gh-action-pypi-publish | |
name: Upload release to TestPyPI | |
runs-on: ubuntu-latest | |
needs: | |
- release-build | |
environment: | |
name: pypi | |
url: https://pypi.org/p/ansible-lint-custom-strict-naming | |
permissions: | |
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing | |
steps: | |
- name: Retrieve release distributions | |
uses: actions/download-artifact@v3 | |
with: | |
name: release-dists | |
path: dist/ | |
- name: Publish release distributions to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 |