From 6dd40b3853e78f3dbcc1ef1b975e75c0c6a7b578 Mon Sep 17 00:00:00 2001 From: Johannes Hoppe Date: Sun, 24 May 2020 17:56:59 +0200 Subject: [PATCH] Move deployment to GitHub action --- .github/workflows/ci.yml | 12 ++--- .github/workflows/release.yml | 31 +++++++++++++ .npmrc | 1 + .travis.yml | 83 ----------------------------------- README.rst | 6 +-- docs/index.rst | 2 +- example/README.md | 2 +- package.json | 6 +-- set_version.py | 2 +- setup.cfg | 2 +- 10 files changed, 48 insertions(+), 99 deletions(-) create mode 100644 .github/workflows/release.yml create mode 100644 .npmrc delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a58f7a38..bf58dc22 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ jobs: black: runs-on: ubuntu-latest steps: - - uses: actions/setup-python@v1 + - uses: actions/setup-python@v2 - uses: actions/checkout@v2 - run: python -m pip install black - run: black --check --diff . @@ -18,7 +18,7 @@ jobs: dist: runs-on: ubuntu-latest steps: - - uses: actions/setup-python@v1 + - uses: actions/setup-python@v2 - run: python -m pip install --upgrade pip setuptools wheel twine readme-renderer - uses: actions/checkout@v2 - run: python setup.py sdist bdist_wheel @@ -27,7 +27,7 @@ jobs: standardjs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - uses: actions/setup-node@v1 with: node-version: '12.x' @@ -37,8 +37,8 @@ jobs: docs: runs-on: ubuntu-latest steps: - - uses: actions/setup-python@v1 - - uses: actions/checkout@v1 + - uses: actions/setup-python@v2 + - uses: actions/checkout@v2 - run: sudo apt-get install -y gettext graphviz - run: python setup.py develop - run: python setup.py build_sphinx -W -b doctest -b html @@ -59,7 +59,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 + uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} - name: Install Chrome diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..3a25ac0e --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,31 @@ +name: Release + +on: + release: + types: [published] + +jobs: + PyPI: + runs-on: ubuntu-latest + steps: + - uses: actions/setup-python@v2 + - uses: actions/checkout@v2 + - name: Install Python dependencies + run: python -m pip install --upgrade pip setuptools wheel twine + - name: Build dist packages + run: python setup.py sdist bdist_wheel + - name: Upload packages + run: python -m twine upload dist/* + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} + + npm: + runs-on: ubuntu-latest + steps: + - uses: actions/setup-node@v1 + - uses: actions/checkout@v2 + - name: Upload packages + run: npm publish + env: + NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} diff --git a/.npmrc b/.npmrc new file mode 100644 index 00000000..fb7f2353 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index fc139e09..00000000 --- a/.travis.yml +++ /dev/null @@ -1,83 +0,0 @@ -language: python -dist: xenial -os: linux - -python: - - "3.6" - - "3.7" - - "3.8" -env: - - DJANGO=22 - - DJANGO=30 - - DJANGO=master - -addons: - apt: - packages: - - chromium-chromedriver - -install: pip install tox-travis codecov - -before_script: - - ln -s /usr/lib/chromium-browser/chromedriver ~/bin/chromedriver - - | - if [[ -z $TOXENV ]]; then - export TOXENV=py$(echo $TRAVIS_PYTHON_VERSION | sed -e 's/\.//g')-dj$DJANGO - fi - - echo $TOXENV - -script: tox - -after_success: codecov - -stages: - - test - - name: deploy - if: tag is present - -jobs: - include: - - python: "3.7" - env: TOXENV=docs - addons: - apt: - packages: - - python3-enchant - - python-enchant - - graphviz - - language: node_js - addons: {} - install: npm install - script: npm test - node_js: lts/* - cache: npm - - stage: deploy - python: "3.8" - install: skip - script: skip - after_success: true - deploy: - provider: pypi - distributions: sdist bdist_wheel - on: - tags: true - username: codingjoe - password: - secure: fEP9K7y0ZF9fRvQEUN4kgPXQEZvi3Cx3ikUebG2UM/2uhcaUQm0+KpgZ2S+lvOTYcBnNgzPzFsVIZMcVcTxwIKuQDEMq9y2eop2hnisb9KXsIm9qPYSzOnRm74VuiOt4hNOZMe0qVBK2cO3vC9NDXuzdI8A0JynJhthfl4t+kFM= - - stage: deploy - language: node_js - node_js: lts/* - python: "3.8" - install: skip - script: skip - after_success: true - before_deploy: - - ./set_version.py - deploy: - cleanup: false - provider: npm - on: - tags: true - email: info@johanneshoppe.com - api_token: - secure: PV38cQx9qhEFkpSdytbM72UzIMCfhpjmRJ8dzT+bCAaOIs5rEcyKN+h1r5ranunCxWyuFsMW4A2iW/SCxnKCR/oPAguuwUbT5ogBXlsskqPFWUxuoTHYMrd+zB+SC6+bMgq+o5ul+kJCYtEkWP6cMlIEzKyTLab7m5PsnDXNVnI= diff --git a/README.rst b/README.rst index 3cb880d5..11f5f469 100644 --- a/README.rst +++ b/README.rst @@ -24,7 +24,7 @@ Documentation available at https://django-select2.readthedocs.io/. .. |version| image:: https://img.shields.io/pypi/v/Django-Select2.svg :target: https://pypi.python.org/pypi/Django-Select2/ -.. |coverage| image:: https://codecov.io/gh/applegrew/django-select2/branch/master/graph/badge.svg - :target: https://codecov.io/gh/applegrew/django-select2 +.. |coverage| image:: https://codecov.io/gh/codingjoe/django-select2/branch/master/graph/badge.svg + :target: https://codecov.io/gh/codingjoe/django-select2 .. |license| image:: https://img.shields.io/badge/license-APL2-blue.svg - :target: https://raw.githubusercontent.com/applegrew/django-select2/master/LICENSE.txt + :target: https://raw.githubusercontent.com/codingjoe/django-select2/master/LICENSE.txt diff --git a/docs/index.rst b/docs/index.rst index 460460af..c27598a6 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -183,7 +183,7 @@ Changelog See `Github releases`_. -.. _Github releases: https://github.com/applegrew/django-select2/releases +.. _Github releases: https://github.com/codingjoe/django-select2/releases All Contents ============ diff --git a/example/README.md b/example/README.md index 9da2c11e..9924f822 100644 --- a/example/README.md +++ b/example/README.md @@ -13,7 +13,7 @@ brew install redis Now, to run the sample app, please execute: ``` -git clone https://github.com/applegrew/django-select2.git +git clone https://github.com/codingjoe/django-select2.git cd django-select2/example python3 -m pip install -r requirements.txt python3 manage.py migrate diff --git a/package.json b/package.json index 8f575b05..e5e68aaa 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ }, "repository": { "type": "git", - "url": "git://github.com/applegrew/django-select2.git" + "url": "git://github.com/codingjoe/django-select2.git" }, "keywords": [ "django", @@ -24,9 +24,9 @@ "author": "Johannes Hoppe", "license": "Apache-2.0", "bugs": { - "url": "https://github.com/applegrew/django-select2/issues" + "url": "https://github.com/codingjoe/django-select2/issues" }, - "homepage": "https://github.com/applegrew/django-select2#readme", + "homepage": "https://github.com/codingjoe/django-select2#readme", "peerDependencies": { "select2": "*", "jquery": ">= 1.2" diff --git a/set_version.py b/set_version.py index 42c0f37d..50ffa7bf 100755 --- a/set_version.py +++ b/set_version.py @@ -7,6 +7,6 @@ with open("package.json", "r+") as f: data = json.load(f) f.seek(0) - data["version"] = os.environ["TRAVIS_TAG"] + data["version"] = os.environ["GITHUB_REF"].rsplit("/")[-1] json.dump(data, f) f.truncate() diff --git a/setup.cfg b/setup.cfg index 13f7473a..98161532 100644 --- a/setup.cfg +++ b/setup.cfg @@ -4,7 +4,7 @@ author = Johannes Hoppe author_email = info@johanneshoppe.com description = Select2 option fields for Django long_description = file: README.rst -url = https://github.com/applegrew/django-select2 +url = https://github.com/codingjoe/django-select2 license = MIT license_file = LICENSE classifier =