|
| 1 | +name: Dev release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches-ignore: |
| 6 | + - dependabot/** |
| 7 | + - pre-commit-ci-update-config |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +jobs: |
| 11 | + wait-tests: |
| 12 | + name: Wait for tests |
| 13 | + runs-on: ubuntu-latest |
| 14 | + |
| 15 | + steps: |
| 16 | + - uses: fountainhead/[email protected] |
| 17 | + id: wait-for-tests |
| 18 | + with: |
| 19 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 20 | + checkName: Tests done |
| 21 | + ref: ${{ github.sha }} |
| 22 | + timeoutSeconds: 3600 |
| 23 | + |
| 24 | + - name: Fail the Build |
| 25 | + uses: cutenode/action-always-fail@v1 |
| 26 | + if: steps.wait-for-tests.outputs.conclusion != 'success' |
| 27 | + |
| 28 | + wait-codeql: |
| 29 | + name: Wait for CodeQL |
| 30 | + runs-on: ubuntu-latest |
| 31 | + |
| 32 | + steps: |
| 33 | + - uses: fountainhead/[email protected] |
| 34 | + id: wait-for-codeql |
| 35 | + with: |
| 36 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 37 | + checkName: Analyze |
| 38 | + ref: ${{ github.sha }} |
| 39 | + timeoutSeconds: 3600 |
| 40 | + |
| 41 | + - name: Fail the Build |
| 42 | + uses: cutenode/action-always-fail@v1 |
| 43 | + if: steps.wait-for-codeql.outputs.conclusion != 'success' |
| 44 | + |
| 45 | + release: |
| 46 | + name: Release package |
| 47 | + runs-on: ubuntu-latest |
| 48 | + needs: [wait-tests, wait-codeql] |
| 49 | + |
| 50 | + steps: |
| 51 | + - name: Checkout code |
| 52 | + uses: actions/checkout@v3 |
| 53 | + with: |
| 54 | + fetch-depth: 0 |
| 55 | + |
| 56 | + - name: Set up Python 3.10 |
| 57 | + uses: actions/setup-python@v4 |
| 58 | + with: |
| 59 | + python-version: '3.10' |
| 60 | + |
| 61 | + - name: Cache pip |
| 62 | + uses: actions/cache@v3 |
| 63 | + with: |
| 64 | + path: ~/.cache/pip |
| 65 | + key: ${{ runner.os }}-python-3.10-dev-release-${{ hashFiles('requirements*.txt') }} |
| 66 | + restore-keys: | |
| 67 | + ${{ runner.os }}-python-3.10-dev-release-${{ hashFiles('requirements*.txt') }} |
| 68 | + ${{ runner.os }}-python-3.10-release-${{ hashFiles('requirements*.txt') }} |
| 69 | + ${{ runner.os }}-python-3.10-tests-${{ hashFiles('requirements*.txt') }} |
| 70 | + ${{ runner.os }}-python-3.10-codeql-${{ hashFiles('requirements*.txt') }} |
| 71 | + ${{ runner.os }}-python-3.10-dev-release- |
| 72 | + ${{ runner.os }}-python-3.10-release- |
| 73 | + ${{ runner.os }}-python-3.10-tests- |
| 74 | + ${{ runner.os }}-python-3.10-codeql- |
| 75 | + ${{ runner.os }}-python |
| 76 | + ${{ runner.os }}- |
| 77 | +
|
| 78 | + - name: Upgrade pip |
| 79 | + run: python -m pip install --upgrade pip setuptools wheel twine |
| 80 | + |
| 81 | + - name: Install dependencies |
| 82 | + run: pip install -r requirements.txt |
| 83 | + |
| 84 | + - name: Patch setup.py with explicit version number |
| 85 | + # Fix for https://github.com/dolfinus/setuptools-git-versioning/issues/72#issuecomment-1312589464 |
| 86 | + run: | |
| 87 | + version=$(python setup.py --version) |
| 88 | + sed -i -E "/from setuptools_git_versioning.*/d" setup.py |
| 89 | + sed -i -E "s/version=.*/version='${version}',/" setup.py |
| 90 | +
|
| 91 | + - name: Build package |
| 92 | + run: python setup.py sdist bdist_wheel |
| 93 | + |
| 94 | + - name: Check package |
| 95 | + run: twine check dist/* |
| 96 | + |
| 97 | + - name: Publish package |
| 98 | + env: |
| 99 | + TWINE_USERNAME: ${{ secrets.TEST_PYPI_USERNAME }} |
| 100 | + TWINE_PASSWORD: ${{ secrets.TEST_PYPI_PASSWORD }} |
| 101 | + run: | |
| 102 | + twine upload --repository testpypi dist/* |
0 commit comments