|
| 1 | +--- |
| 2 | +name: dist |
| 3 | + |
| 4 | +on: |
| 5 | + pull_request: |
| 6 | + push: |
| 7 | + # branches: |
| 8 | + # - main |
| 9 | + # tags: |
| 10 | + # - '*' |
| 11 | + |
| 12 | +jobs: |
| 13 | + check: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@v2 |
| 17 | + - uses: psf/black@stable |
| 18 | + |
| 19 | + build-whl: |
| 20 | + runs-on: ubuntu-18.04 |
| 21 | + |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@v2 |
| 24 | + with: |
| 25 | + fetch-depth: 0 |
| 26 | + |
| 27 | + - uses: actions/setup-python@v2 |
| 28 | + with: |
| 29 | + python-version: 3.9 |
| 30 | + |
| 31 | + - uses: robotpy/build-actions/install-pure-build-deps@v2021 |
| 32 | + - uses: robotpy/build-actions/build-wheel@v2021 |
| 33 | + - uses: robotpy/build-actions/test-native-wheel@v2021 |
| 34 | + |
| 35 | + - uses: robotpy/build-actions/validate-sphinx@v2021 |
| 36 | + |
| 37 | + build-exe: |
| 38 | + runs-on: ubuntu-18.04 |
| 39 | + |
| 40 | + steps: |
| 41 | + - uses: actions/checkout@v2 |
| 42 | + with: |
| 43 | + fetch-depth: 0 |
| 44 | + |
| 45 | + - shell: bash |
| 46 | + run: | |
| 47 | + ./build_exe.sh |
| 48 | + rm -f dist/windows/pynetworktables2js.exe |
| 49 | +
|
| 50 | + - uses: actions/upload-artifact@v2 |
| 51 | + with: |
| 52 | + name: dist |
| 53 | + path: dist |
| 54 | + |
| 55 | + publish-pypi: |
| 56 | + runs-on: ubuntu-18.04 |
| 57 | + needs: [check, build-whl, build-exe] |
| 58 | + if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') |
| 59 | + |
| 60 | + steps: |
| 61 | + - uses: actions/checkout@v2 |
| 62 | + |
| 63 | + - uses: actions/setup-python@v2 |
| 64 | + with: |
| 65 | + python-version: 3.9 |
| 66 | + - run: pip install wheel |
| 67 | + |
| 68 | + - name: Build packages |
| 69 | + run: python setup.py sdist bdist_wheel |
| 70 | + - name: Publish to PyPI |
| 71 | + uses: pypa/gh-action-pypi-publish@master |
| 72 | + with: |
| 73 | + user: __token__ |
| 74 | + password: ${{ secrets.pypi_password }} |
| 75 | + |
| 76 | + publish-github: |
| 77 | + runs-on: ubuntu-18.04 |
| 78 | + needs: [check, build-whl, build-exe] |
| 79 | + if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') |
| 80 | + |
| 81 | + steps: |
| 82 | + - uses: actions/download-artifact@v2 |
| 83 | + with: |
| 84 | + name: dist |
| 85 | + path: dist/ |
| 86 | + |
| 87 | + - name: "Determine tag" |
| 88 | + id: "determine-tag" |
| 89 | + shell: bash |
| 90 | + run: "echo \"::set-output name=tag::${GITHUB_REF#refs/tags/}\"" |
| 91 | + |
| 92 | + - name: Create Release |
| 93 | + id: create_release |
| 94 | + uses: actions/create-release@v1 |
| 95 | + env: |
| 96 | + GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }} |
| 97 | + with: |
| 98 | + tag_name: ${{ steps.determine-tag.outputs.tag }} |
| 99 | + release_name: Release ${{ steps.determine-tag.outputs.tag }} |
| 100 | + draft: false |
| 101 | + prerelease: false |
| 102 | + |
| 103 | + - name: Upload Release Asset |
| 104 | + id: upload-release-asset |
| 105 | + uses: actions/upload-release-asset@v1 |
| 106 | + env: |
| 107 | + GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }} |
| 108 | + with: |
| 109 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 110 | + asset_path: ./dist/pynetworktables2js-${{ steps.determine-tag.outputs.tag }}.zip |
| 111 | + asset_name: pynetworktables2js-${{ steps.determine-tag.outputs.tag }}.zip |
| 112 | + asset_content_type: application/zip |
0 commit comments