Newer
Older
skill-ovos-flowtoys / .github / workflows / publish_alpha.yml
@miro miro on 15 May 2024 3 KB automations/translations
# This workflow will generate a distribution and upload it to PyPI

name: Publish Alpha Build ...aX
on:
  push:
    branches:
      - dev
    paths-ignore:
      - 'version.py'
      - '.github/**'
      - '.gitignore'
      - 'LICENSE'
      - 'CHANGELOG.md'
      - 'MANIFEST.in'
      - 'README.md'
      - 'scripts/**'
      - 'translations/**'
  workflow_dispatch:

jobs:
  autotranslate:
    runs-on: ubuntu-latest
    env:
      API_KEY: ${{secrets.DL_API_KEY}} 
    steps:
      - uses: actions/checkout@v3
        with:
          ref: dev
          fetch-depth: 0
      - uses: dorny/paths-filter@v2
        id: filter
        with:
          filters: |
            locales:
              - 'locale/en-us/**'
              - 'dialog/en-us/**'
              - 'vocab/en-us/**'
      - name: Setup Python
        if: steps.filter.outputs.locales == 'true'
        uses: actions/setup-python@v4
        with:
          python-version: 3.8
      - name: Auto Translate
        if: steps.filter.outputs.locales == 'true'
        run: |
          python -m pip install ovos-translate-plugin-deepl ovos-utils
          python scripts/translate.py
      - name: Commit to dev
        if: steps.filter.outputs.locales == 'true'
        uses: stefanzweifel/git-auto-commit-action@v4
        with:
          commit_message: autotranslate
          branch: dev
    
  build_and_publish:
    runs-on: ubuntu-latest 
    steps:
      - uses: actions/checkout@v3
        with:
          ref: dev
          fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.
      - name: Setup Python
        uses: actions/setup-python@v4
        with:
          python-version: 3.8
      - name: Install Build Tools
        run: |
          python -m pip install build wheel
      - name: Increment Version
        run: |
          VER=$(python setup.py --version)
          python scripts/bump_alpha.py
      - name: "Generate release changelog"
        uses: heinrichreimer/[email protected]
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
        id: changelog
      - name: Commit to dev
        uses: stefanzweifel/git-auto-commit-action@v4
        with:
          commit_message: Increment Version
          branch: dev
      - name: version
        run: echo "::set-output name=version::$(python setup.py --version)"
        id: version
      - name: Create Release
        id: create_release
        uses: actions/create-release@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
        with:
          tag_name: V${{ steps.version.outputs.version }}
          release_name: Release ${{ steps.version.outputs.version }}
          body: |
            Changes in this Release
            ${{ steps.changelog.outputs.changelog }}
          draft: false
          prerelease: true
          commitish: dev
      - name: Build Distribution Packages
        run: |
          python setup.py bdist_wheel
      - name: Publish to Test PyPI
        uses: pypa/gh-action-pypi-publish@release/v1
        with:
          password: ${{secrets.PYPI_TOKEN}}