Development Artifacts #69
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Development Artifacts | |
| on: | |
| push: | |
| branches: | |
| - develop | |
| workflow_dispatch: | |
| inputs: | |
| force: | |
| description: 'Force deploy' | |
| required: false | |
| default: false | |
| type: boolean | |
| jobs: | |
| check-changes: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| any_changed: ${{ steps.changed-files.outputs.any_changed }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v2 | |
| with: | |
| fetch-depth: 0 | |
| - name: Get changed files | |
| id: changed-files | |
| uses: tj-actions/changed-files@v45 | |
| with: | |
| files: | | |
| **.py | |
| build: | |
| runs-on: ubuntu-latest | |
| needs: check-changes | |
| if: needs.check-changes.outputs.any_changed == 'true' || github.event.inputs.force == 'true' | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v2 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.10' | |
| - name: Install Poetry | |
| uses: snok/install-poetry@v1.4.1 | |
| with: | |
| virtualenvs-in-project: true | |
| installer-parallel: true | |
| - name: Bump version | |
| id: bump-version | |
| run: | | |
| echo "Bumping version..." | |
| ./scripts/run_on_each.sh poetry version prerelease | |
| echo "Version bumped to $(poetry version -s)" | |
| NEW_TAG=v$(poetry version --short) | |
| # Finally because we want to be able to use the variable in later | |
| # steps we set a NEW_TAG environmental variable | |
| echo "NEW_TAG=$(echo ${NEW_TAG})" >> $GITHUB_ENV | |
| - name: Install dependencies | |
| run: | | |
| ./scripts/run_on_each.sh poetry self add poetry-plugin-export | |
| ./scripts/poetry_install.sh | |
| - name: Build project | |
| run: ./scripts/poetry_build.sh | |
| - name: Commit bumped version | |
| run: | | |
| git config --global user.name 'gridappsd[bot]' | |
| git config --global user.email 'gridappsd[bot]@users.noreply.github.com' | |
| git commit -am "Bump version to $(poetry version -s)" | |
| git push origin develop | |
| - name: Create Release | |
| uses: ncipollo/release-action@v1.15.0 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| artifacts: "dist/*.gz,dist/*.whl" | |
| artifactErrorsFailBuild: true | |
| generateReleaseNotes: true | |
| commit: ${{ github.ref }} | |
| prerelease: true | |
| tag: ${{ env.NEW_TAG }} | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Publish to PyPI | |
| id: publish-to-pypi | |
| run: | | |
| # This is needed, because the poetry publish will fail at the top level of the project | |
| # so ./scripts/run_on_each.sh fails for that. | |
| echo "POETRY_PUBLISH_OPTIONS=''" >> $GITHUB_ENV | |
| cd gridappsd-python-lib | |
| poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }} | |
| poetry publish | |
| cd ../gridappsd-field-bus-lib | |
| poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }} | |
| poetry publish |