WIP #148
This file contains 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: Build package | |
on: | |
push: | |
jobs: | |
set_version: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Get branch name | |
id: branch_name | |
run: | | |
GIT_BRANCH=`git symbolic-ref --short HEAD | sed "s/[^[:alnum:].]//g"` | |
echo "::set-output name=GIT_BRANCH::${GIT_BRANCH}" | |
- name: Get semantic version | |
uses: paulhatch/[email protected] | |
id: versioning | |
with: | |
tag_prefix: "v" | |
major_pattern: "[MAJOR]" | |
minor_pattern: "[MINOR]" | |
format: "${major}.${minor}.${patch}.dev${increment}" | |
bump_each_commit: false | |
outputs: | |
version: ${{ github.ref == 'refs/heads/master' && steps.versioning.outputs.version_tag || steps.versioning.outputs.version}} | |
build_wheel: | |
runs-on: ubuntu-20.04 | |
needs: [ set_version ] | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v2 | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v1 | |
with: | |
python-version: 3.8 | |
- name: Install build dependencies | |
shell: bash -l {0} | |
working-directory: ./ton-http-api/ | |
run: | | |
python -m pip install build wheel | |
python -m pip install -r requirements.txt | |
- name: Build distributions | |
shell: bash -l {0} | |
working-directory: ./ton-http-api/ | |
run: TON_HTTP_API_VERSION=${{ needs.set_version.outputs.version }} python setup.py sdist bdist_wheel | |
- name: Check distributions | |
shell: bash -l {0} | |
working-directory: ./ton-http-api/ | |
run: | | |
echo $(pwd) | |
ls $(pwd)/ | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ton-http-api-package | |
path: | | |
ton-http-api/dist/*.whl | |
ton-http-api/dist/*.tar.gz | |
upload-pypi: | |
runs-on: ubuntu-20.04 | |
needs: [ set_version, build_wheel ] | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: ton-http-api-package | |
path: dist | |
- name: Check distributions | |
shell: bash -l {0} | |
run: ls -la dist/ | |
- name: Create release tag | |
if: ${{ github.repository == 'toncenter/ton-http-api' && github.event_name == 'push' && github.ref == 'refs/heads/master' }} | |
uses: actions/github-script@v3 | |
with: | |
github-token: ${{ github.token }} | |
script: | | |
github.git.createRef({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: 'refs/tags/${{ needs.set_version.outputs.version }}', | |
sha: context.sha | |
}) | |
- name: Publish package to test PyPI | |
if: ${{ github.repository == 'toncenter/ton-http-api' && github.event_name == 'push' }} | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.TEST_PYPI_PASSWORD }} | |
repository_url: https://test.pypi.org/legacy/ | |
- name: Publish package to PyPI | |
if: ${{ github.repository == 'toncenter/ton-http-api' && github.event_name == 'push' && github.ref == 'refs/heads/master' }} | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_PASSWORD }} | |
repository_url: https://upload.pypi.org/legacy/ |