Skip to content

fix: permissions for release #176

fix: permissions for release

fix: permissions for release #176

Workflow file for this run

name: GitHub CI
on:
pull_request:
push:
tags:
- "*"
branches:
- main
- sync/*
workflow_dispatch:
env:
MAIN_PYTHON_VERSION: '3.10'
PYTHON_VERSION: '3.10'
LIBRARY_NAME: 'ansys-scadeone-core'
DOCUMENTATION_CNAME: 'scadeone.docs.pyansys.com'
PACKAGE_NAMESPACE: 'ansys.scadeone.core'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
update-changelog:
name: "Update CHANGELOG (on release)"
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: ansys/actions/doc-deploy-changelog@v8
with:
token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }}
bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }}
bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }}
pr-name:
if: github.event_name == 'pull_request'
name: Check the name of the PR
runs-on: ubuntu-latest
steps:
- name: Check commit name
uses: ansys/actions/check-pr-title@v8
with:
token: ${{ secrets.GITHUB_TOKEN }}
code-style:
name: Code style
runs-on: ubuntu-latest
steps:
- uses: ansys/actions/code-style@v8
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
doc-style:
name: Doc style
runs-on: ubuntu-latest
steps:
- uses: ansys/actions/doc-style@v8
with:
token: ${{ secrets.GITHUB_TOKEN }}
doc-build:
name: Doc building
needs: [doc-style]
runs-on: [windows-latest]
steps:
- uses: ansys/actions/doc-build@v8
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
sphinxopts: -j auto -W
add-pdf-html-docs-as-assets: false
smoke-test:
name: Smoke test
needs: code-style
runs-on: [ubuntu-latest]
steps:
- uses: ansys/actions/tests-pytest@v8
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
pytest-postargs: 'tests/test_smoke.py'
build-library:
name: Build
if: ${{ !contains(github.event.pull_request.title, '[skip tests]') }}
needs: [smoke-test, doc-build]
runs-on: [ubuntu-latest]
steps:
- uses: ansys/actions/build-library@v8
with:
library-name: ${{ env.LIBRARY_NAME }}
python-version: ${{ env.MAIN_PYTHON_VERSION }}
doc-deploy-dev:
name: "Deploy development documentation"
# Deploy development only when merging or pushing to the 'main' branch
runs-on: ubuntu-latest
needs: [build-library]
if: github.ref == 'refs/heads/main'
steps:
- uses: ansys/actions/doc-deploy-dev@v8
with:
doc-artifact-name: 'documentation-html'
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}
bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }}
bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }}
release:
name: "Release project"
runs-on: ubuntu-latest
needs: [build-library]
permissions:
id-token: write
contents: write
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
steps:
- name: "Release to public PyPI"
uses: ansys/actions/release-pypi-public@v8
with:
library-name: ${{ env.LIBRARY_NAME }}
use-trusted-publisher: true
- name: "Release to GitHub"
uses: ansys/actions/release-github@v8
with:
library-name: ${{ env.LIBRARY_NAME }}
additional-artifacts: 'examples'
doc-deploy-stable:
name: "Deploy stable documentation"
# Deploy release documentation when creating a new tag
runs-on: ubuntu-latest
needs: [release]
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
steps:
- uses: ansys/actions/doc-deploy-stable@v8
with:
doc-artifact-name: 'documentation-html'
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}
bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }}
bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }}