Skip to content
This repository has been archived by the owner on Jun 9, 2024. It is now read-only.

Expose MessageId in Email backend (#24) #41

Expose MessageId in Email backend (#24)

Expose MessageId in Email backend (#24) #41

name: Toolkit Library Deploy
concurrency: deploy
on:
push:
branches:
- main
paths:
- 'pythonit_toolkit/**/*'
- 'pyproject.toml'
workflow_dispatch:
inputs:
comment-id:
description: 'The comment-id of the slash command'
required: true
event-number:
description: 'The event-id of the slash command'
required: true
jobs:
publish-library:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
persist-credentials: false
ref: ${{ github.ref }}
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.11
- name: Install poetry
run: pip install poetry
- name: Metadata
id: metadata
run: echo "::set-output name=commit::$(git rev-parse HEAD)"
- name: Find Release Comment
uses: peter-evans/find-comment@v1
id: find_comment
if: ${{ github.ref != 'refs/heads/main' }}
with:
token: ${{ secrets.BOT_TOKEN }}
issue-number: ${{ github.event.inputs.event-number }}
comment-author: pythonitaliabot
body-includes: "Pre-release"
- name: Create or update comment
id: initial-comment
uses: peter-evans/create-or-update-comment@v1
if: ${{ github.ref != 'refs/heads/main' }}
with:
token: ${{ secrets.BOT_TOKEN }}
comment-id: ${{ steps.find_comment.outputs.comment-id }}
issue-number: ${{ github.event.inputs.event-number }}
body: |
# Pre-release
:wave:
Releasing commit [${{ steps.metadata.outputs.commit }}] to PyPi as pre-release! :package:
edit-mode: replace
- name: Update version
if: ${{ github.ref == 'refs/heads/main' }}
run: poetry version patch
- name: Update to pre-release version
if: ${{ github.ref != 'refs/heads/main' }}
run: |
poetry version patch
poetry version $(poetry version -s)-dev.$(date '+%s')
- name: Build & Publish
id: release
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
run: |
poetry publish --username __token__ --build
echo "::set-output name=version::$(poetry version -s)"
- name: Commit version
if: ${{ github.ref == 'refs/heads/main' }}
env:
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
run: |
git remote set-url origin https://${{ secrets.BOT_TOKEN }}@github.com/${{ github.repository }}
git config user.name "Python Italia [bot]"
git config user.email "[email protected]"
git add pyproject.toml
git commit -m "🔨 Publish Toolkit v$(poetry version -s) [skip ci]"
git push
- name: Create or update comment
uses: peter-evans/create-or-update-comment@v1
if: ${{ github.ref != 'refs/heads/main' }}
with:
token: ${{ secrets.BOT_TOKEN }}
comment-id: ${{ steps.initial-comment.outputs.comment-id }}
issue-number: ${{ github.event.inputs.event-number }}
body: |
# Pre-release
:wave:
Pre-release **${{ steps.release.outputs.version }}** [${{ steps.metadata.outputs.commit }}] has been released on PyPi! :rocket:
You can try it by doing:
```shell
poetry add pythonit-toolkit==${{ steps.release.outputs.version }}
```
edit-mode: replace