|
| 1 | +name: Release |
| 2 | +on: [push, pull_request] |
| 3 | + |
| 4 | +jobs: |
| 5 | + test: |
| 6 | + name: Test Job |
| 7 | + # Support [skip ci] out of box with github actions Workaround |
| 8 | + # Only works for push https://github.com/actions/runner/issues/774 |
| 9 | + if: github.event_name == 'pull_request' || (github.event_name == 'push' && contains(toJson(github.event.commits), '[skip ci]') == false) |
| 10 | + runs-on: ubuntu-latest |
| 11 | + steps: |
| 12 | + - name: Checkout |
| 13 | + uses: actions/checkout@v2 |
| 14 | + - uses: actions/setup-python@v2 |
| 15 | + with: |
| 16 | + python-version: "3.x" # Version range or exact version of a Python version to use, using SemVer's version range syntax |
| 17 | + - name: Install dependencies |
| 18 | + run: | |
| 19 | + pip install --upgrade pip |
| 20 | + pip -V |
| 21 | + pip install --upgrade -r requirements.txt |
| 22 | + pip install --upgrade -e . |
| 23 | + - name: Validate & Coverage Report |
| 24 | + run: | |
| 25 | + "./scripts/pep8check.sh" |
| 26 | + "./scripts/coverage.sh" |
| 27 | + release: |
| 28 | + name: Release Job |
| 29 | + runs-on: ubuntu-latest |
| 30 | + needs: |
| 31 | + - test |
| 32 | + if: github.ref == 'refs/heads/master' && github.event_name == 'push' |
| 33 | + steps: |
| 34 | + - name: Checkout |
| 35 | + uses: actions/checkout@v2 |
| 36 | + with: |
| 37 | + fetch-depth: 0 |
| 38 | + persist-credentials: false |
| 39 | + - uses: actions/setup-python@v2 |
| 40 | + with: |
| 41 | + python-version: "3.x" |
| 42 | + - name: Install dependencies |
| 43 | + run: | |
| 44 | + pip install --upgrade pip |
| 45 | + pip -V |
| 46 | + pip install --upgrade -r requirements.txt |
| 47 | + pip install --upgrade -e . |
| 48 | + - name: Setup NodeJS LTS |
| 49 | + uses: actions/setup-node@v2 |
| 50 | + - name: Install dependencies |
| 51 | + run: | |
| 52 | + npm prune && npm i |
| 53 | + - name: Release |
| 54 | + env: |
| 55 | + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} |
| 56 | + TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }} |
| 57 | + TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} |
| 58 | + run: npx semantic-release |
0 commit comments