From 3f50a8819bba039f738ff6b558a37694ebdc5977 Mon Sep 17 00:00:00 2001 From: Andrei Batomunkuev Date: Sat, 27 Nov 2021 03:44:09 -0500 Subject: [PATCH] Added GitHub Actions workflow to publish release on PYPI: - Added workflow - Updated CONTRIBUTING.md page --- .github/workflows/release.yml | 28 ++++++++++++++++++++++++++++ CONTRIBUTING.md | 19 +++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..cbbe709 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,28 @@ +name: Build distribution +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.6","3.7"] + steps: + - name: Checkout source + uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + with: + python-version: ${{ matrix.python-version }} + - name: Install build dependencies + run: python -m pip install build wheel + - name: Build distributions + shell: bash -l {0} + run: python setup.py sdist bdist_wheel + - name: Publish package to PYPI + if: github.repository == 'abatomunkuev/static_site_generator' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags') + uses: pypa/gh-action-pypi-publish@master + with: + passwords: ${{secrets.pypi_password}} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b1962cf..b202222 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -43,4 +43,23 @@ pytest tests/ You can run all the tests and code-formatting in one-step by running: ``` ./run_python_tests.sh +``` + +## Releasing +Releases are published automatically when a tag is pushed to GitHub. +```bash + # Set next version number + export RELEASE=x.x.x + + # Create tags + git commit --allow-empty -m "Release $RELEASE" + git tag -a $RELEASE -m "Version $RELEASE" + + # Push + git push upstream --tags +``` + +Pushing upstream assumes we are working from a fork, if we are not doing that that it would be: +```bash + git push origin --tags ``` \ No newline at end of file