diff --git a/.github/workflows/build-release-publish.yml b/.github/workflows/build-release-publish.yml new file mode 100644 index 0000000..1f17218 --- /dev/null +++ b/.github/workflows/build-release-publish.yml @@ -0,0 +1,74 @@ +name: BRP + +on: + push: + tags: + - '*.*.*' + +jobs: + + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.x' + - name: Install poetry + run: | + curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python + echo "PATH=$HOME/.poetry/bin:$PATH" >> $GITHUB_ENV + - name: Build distributions + run: | + poetry build + - name: Upload distribution artifacts + uses: actions/upload-artifact@v2 + with: + name: gareth-dist + path: dist + + release: + needs: [build] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Get release tag + id: tag + run: | + echo ::set-output name=tag::${GITHUB_REF#refs/tags/} + - name: Create release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ steps.tag.outputs.tag }} + release_name: ${{ steps.tag.outputs.tag }} + body_path: ./releases/${{ steps.tag.outputs.tag }}.md + + publish: + needs: [release] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Download distribution artifact + uses: actions/download-artifact@v2 + with: + name: gareth-dist + path: dist + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.x' + - name: Install poetry + run: | + curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python + echo "PATH=$HOME/.poetry/bin:$PATH" >> $GITHUB_ENV + - name: Configure pypi credentials + env: + PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }} + run: | + poetry config http-basic.pypi __token__ "$PYPI_API_TOKEN" + - name: Publish release to pypi + run: | + poetry publish