Switch user group (#49) #26
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" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref_name }} | |
cancel-in-progress: true | |
permissions: | |
contents: write | |
pull-requests: write | |
on: | |
push: | |
branches: | |
- main | |
- master | |
jobs: | |
trigger-release: | |
runs-on: ubuntu-latest | |
outputs: | |
release_created: ${{ steps.release.outputs.release_created }} | |
major: ${{ steps.release.outputs.major }} | |
minor: ${{ steps.release.outputs.minor }} | |
patch: ${{ steps.release.outputs.patch }} | |
tag_name: ${{ steps.release.outputs.tag_name }} | |
steps: | |
- id: release | |
uses: google-github-actions/release-please-action@v4 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
target-branch: ${{ github.ref_name }} | |
config-file: .github/release-please-config.json | |
manifest-file: .github/.release-please-manifest.json | |
publish-release: | |
name: "Publish package to GitHub and PyPi release" | |
needs: trigger-release | |
if: needs.trigger-release.outputs.release_created | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install python | |
uses: actions/setup-python@v5 | |
with: | |
python-version-file: 'pyproject.toml' | |
- name: Print python version | |
run: python --version | |
- name: Load cached Poetry installation | |
id: cached-poetry | |
uses: actions/cache@v4 | |
with: | |
path: ~/.local # the path depends on the OS | |
key: poetry-0 | |
- name: Setup Poetry | |
uses: snok/install-poetry@v1 | |
if: steps.cached-poetry.outputs.cache-hit != 'true' | |
with: | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
- name: Build Package | |
run: | | |
poetry build --no-interaction --format=wheel | |
- name: Add artifacts to release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
echo "Uploading artifacts to release ${{ needs.trigger-release.outputs.tag_name }}" | |
gh release upload ${{ needs.trigger-release.outputs.tag_name }} ./dist/*.whl | |
- name: Publish package to PyPi | |
run: | | |
poetry config repositories.nuvla-api https://pypi.org/project/nuvla-api/ | |
poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }} | |
poetry publish | |
job-notify: | |
if: needs.trigger-release.outputs.release_created | |
name: Post Workflow Status To Slack | |
needs: publish-release | |
runs-on: ubuntu-latest | |
steps: | |
- uses: Gamesight/slack-workflow-status@master | |
with: | |
repo_token: ${{secrets.GITHUB_TOKEN}} | |
slack_webhook_url: ${{secrets.SLACK_WEBHOOK_URL}} | |