Skip to content

ci(cd): set write permissions to allow PyPI trusted publisher #49

ci(cd): set write permissions to allow PyPI trusted publisher

ci(cd): set write permissions to allow PyPI trusted publisher #49

Workflow file for this run

name: CD
on:
workflow_dispatch:
push:
branches:
- "main"
jobs:
release:
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get version from file
run: |
VERSION_FILE="$/helx_base/_version.py"
HELX_VERSION="$(cat helx_base/_version.py | grep '__version__ = ' | cut -d'=' -f2 | sed 's,\",,g' | sed "s,\',,g" | sed 's, ,,g')"
echo "Current version is:"
echo "$HELX_VERSION"
echo "HELX_VERSION=$HELX_VERSION" >> $GITHUB_ENV
- name: Create changelog and push tag
id: changelog
uses: TriPSs/conventional-changelog-action@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
output-file: false
fallback-version: ${{ env.HELX_VERSION }}
skip-commit: true
- name: Create Release
uses: ncipollo/release-action@v1
with:
tag: ${{ env.HELX_VERSION }}
name: "HELX release v${{ env.HELX_VERSION }}"
body: ${{ steps.changelog.outputs.clean_changelog }}
- uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Install pypa/build
run: |
python -m pip install build
- name: Build wheel and sdist
run: |
python -m build --sdist --wheel --outdir dist/ .
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
verbose: true