properly add auth #10
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: Package, Tag and Release | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
permissions: | |
contents: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.12' # Specify your Python version here | |
- name: Install Poetry | |
run: | | |
curl -sSL https://install.python-poetry.org | python3 - | |
export PATH="$HOME/.local/bin:$PATH" | |
- name: Install Podman | |
run: | | |
sudo apt-get update | |
sudo apt-get -y install podman | |
- name: Install poetry project dependencies | |
run: poetry install | |
- name: Run your command with Poetry | |
run: poetry run crzd build | |
- name: Extract version from pyproject.toml | |
id: extract_version | |
run: | | |
VERSION=$(grep -E '^version\s*=' pyproject.toml | sed -E 's/version = "(.*)"/\1/') | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
- name: Create and push tag | |
env: | |
VERSION: ${{ env.VERSION }} | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git tag -a "v$VERSION" -m "Version $VERSION" | |
git push -f origin "v$VERSION" | |
- name: Delete existing GitHub release if it exists | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
VERSION: ${{ env.VERSION }} | |
run: | | |
if gh release view "v$VERSION" >/dev/null 2>&1; then | |
gh release delete "v$VERSION" -y | |
else | |
echo "Release for tag v$VERSION not found, skipping delete." | |
fi | |
- name: Create GitHub release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: "v${{ env.VERSION }}" | |
release_name: "v${{ env.VERSION }}" | |
draft: false | |
prerelease: false | |
- name: debug | |
id: ls | |
run: | | |
ls -lah . | |
ls -lah dist/ | |
- name: Upload wheel file using GitHub CLI | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
VERSION: ${{ env.VERSION }} | |
run: gh release upload "v${VERSION}" dist/*.whl |