|
| 1 | +# Publish package on main branch if it's tagged with 'v*' |
| 2 | + |
| 3 | +name: release & publish workflow |
| 4 | + |
| 5 | +# Controls when the action will run. |
| 6 | +on: |
| 7 | + # Triggers the workflow on push events but only for the master branch |
| 8 | + push: |
| 9 | + tags: |
| 10 | + - 'v*' |
| 11 | + |
| 12 | + # Allows you to run this workflow manually from the Actions tab |
| 13 | + workflow_dispatch: |
| 14 | + |
| 15 | +# A workflow run is made up of one or more jobs that can run sequentially or in parallel |
| 16 | +jobs: |
| 17 | + # This workflow contains a single job called "release" |
| 18 | + release: |
| 19 | + name: Create Release |
| 20 | + runs-on: ubuntu-20.04 |
| 21 | + |
| 22 | + strategy: |
| 23 | + matrix: |
| 24 | + python-versions: [3.8] |
| 25 | + |
| 26 | + # Steps represent a sequence of tasks that will be executed as part of the job |
| 27 | + steps: |
| 28 | + - name: Get version from tag |
| 29 | + id: tag_name |
| 30 | + run: | |
| 31 | + echo ::set-output name=current_version::${GITHUB_REF#refs/tags/v} |
| 32 | + shell: bash |
| 33 | + |
| 34 | + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
| 35 | + - uses: actions/checkout@v2 |
| 36 | + |
| 37 | + - name: Get Changelog Entry |
| 38 | + id: changelog_reader |
| 39 | + uses: mindsers/changelog-reader-action@v2 |
| 40 | + with: |
| 41 | + validation_depth: 10 |
| 42 | + version: ${{ steps.tag_name.outputs.current_version }} |
| 43 | + path: ./CHANGELOG.md |
| 44 | + |
| 45 | + - uses: actions/setup-python@v2 |
| 46 | + with: |
| 47 | + python-version: ${{ matrix.python-versions }} |
| 48 | + |
| 49 | + - name: Install dependencies |
| 50 | + run: | |
| 51 | + python -m pip install --upgrade pip |
| 52 | + pip install poetry |
| 53 | +
|
| 54 | + - name: build documentation |
| 55 | + run: | |
| 56 | + poetry install -E doc |
| 57 | + poetry run mkdocs build |
| 58 | +
|
| 59 | + - name: publish documentation |
| 60 | + uses: peaceiris/actions-gh-pages@v3 |
| 61 | + with: |
| 62 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 63 | + publish_dir: ./site |
| 64 | + |
| 65 | + # - name: Build wheels and source tarball |
| 66 | + # run: >- |
| 67 | + # poetry build |
| 68 | + |
| 69 | + # - name: show temporary files |
| 70 | + # run: >- |
| 71 | + # ls -l |
| 72 | + |
| 73 | + # - name: create github release |
| 74 | + # id: create_release |
| 75 | + # uses: softprops/action-gh-release@v1 |
| 76 | + # env: |
| 77 | + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 78 | + # with: |
| 79 | + # body: ${{ steps.changelog_reader.outputs.changes }} |
| 80 | + # files: dist/*.whl |
| 81 | + # draft: false |
| 82 | + # prerelease: false |
| 83 | + |
| 84 | + # - name: publish to PyPI |
| 85 | + # uses: pypa/gh-action-pypi-publish@release/v1 |
| 86 | + # with: |
| 87 | + # user: __token__ |
| 88 | + # password: ${{ secrets.PYPI_API_TOKEN }} |
| 89 | + # skip_existing: true |
0 commit comments