From f7f31baf877dd17fc697d0184019382e3b63f929 Mon Sep 17 00:00:00 2001 From: dolfies Date: Fri, 8 Jul 2022 13:28:05 -0400 Subject: [PATCH] Cleanup workflow actions --- .github/workflows/build.yml | 15 +++----- .github/workflows/lint.yml | 17 ++++----- .github/workflows/publish.yml | 30 ++++++++++++++++ .github/workflows/python-publish.yml | 32 ----------------- .github/workflows/rename.yml | 53 ++++++++++++++-------------- .github/workflows/test.yml | 15 +++----- 6 files changed, 72 insertions(+), 90 deletions(-) create mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/python-publish.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 05c5bdd33..5fbc95531 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: build +name: Build on: push: @@ -8,21 +8,16 @@ on: jobs: dists-and-docs: runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - python-version: [ '3.8' ] - - name: dists & docs steps: - - uses: actions/checkout@v2 + - name: Checkout repository + uses: actions/checkout@v2 with: fetch-depth: 0 - - name: Set up CPython ${{ matrix.python-version }} + - name: Set up CPython 3.8 uses: actions/setup-python@v2 with: - python-version: ${{ matrix.python-version }} + python-version: '3.8' - name: Install dependencies run: | diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 0f17fb701..6f8dd5a59 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,4 +1,4 @@ -name: lint +name: Lint on: push: @@ -8,21 +8,16 @@ on: jobs: check: runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - python-version: [ '3.8' ] - - name: lint steps: - - uses: actions/checkout@v2 + - name: Checkout repository + uses: actions/checkout@v2 with: fetch-depth: 0 - - name: Set up CPython ${{ matrix.python-version }} + - name: Set up CPython 3.8 uses: actions/setup-python@v2 with: - python-version: ${{ matrix.python-version }} + python-version: '3.8' - name: Install dependencies id: install-deps @@ -30,7 +25,7 @@ jobs: python -m pip install --upgrade pip setuptools wheel black pip install -U -r requirements.txt - - name: Setup node.js + - name: Set up node.js uses: actions/setup-node@v2 with: node-version: '16' diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 000000000..e38d54285 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,30 @@ +name: Publish + +on: + workflow_dispatch: + release: + types: [ created ] + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up CPython 3.8 + uses: actions/setup-python@v2 + with: + python-version: '3.8' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip setuptools wheel twine + + - name: Build and publish + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + run: | + python setup.py sdist bdist_wheel + twine upload dist/* diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml deleted file mode 100644 index c7b32960f..000000000 --- a/.github/workflows/python-publish.yml +++ /dev/null @@ -1,32 +0,0 @@ -# This workflow will upload a Python Package using Twine when a release is created -# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries - -name: Upload Python Package - -on: - workflow_dispatch: - release: - types: [created] - -jobs: - deploy: - - name: push to PyPi - 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 dependencies - run: | - python -m pip install --upgrade pip - pip install setuptools wheel twine - - name: Build and publish - env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} - run: | - python setup.py sdist bdist_wheel - twine upload dist/* diff --git a/.github/workflows/rename.yml b/.github/workflows/rename.yml index 37b96e06b..063404bb8 100644 --- a/.github/workflows/rename.yml +++ b/.github/workflows/rename.yml @@ -1,40 +1,39 @@ -name: rename +name: Rename on: workflow_dispatch: push: - branches: - - master + branches: [ master ] jobs: - build: + rename: runs-on: ubuntu-latest steps: - - name: Checkout repository - uses: actions/checkout@v2 - with: - fetch-depth: 0 + - name: Checkout repository + uses: actions/checkout@v2 + with: + fetch-depth: 0 - - name: Replace instances - run: | - git config --global user.name 'github-actions[bot]' - git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com' + - name: Replace instances + run: | + git config --global user.name 'github-actions[bot]' + git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com' - git checkout -b temp master - cp .github/files/README.rst README.rst - rm -rf docs .github .readthedocs.yml tests - mv discord selfcord + git checkout -b temp master + cp .github/files/README.rst README.rst + rm -rf docs .github .readthedocs.yml tests + mv discord selfcord - sed -i -e 's/import discord/import selfcord/g' -e 's/from discord/from selfcord/g' -e 's/from discord/from selfcord/g' -e 's/discord\.py-self/selfcord\.py/g' -e '/\(discord\.com\|discord\.gg\|discord\.new\)/! s/discord\./selfcord\./g' $(find selfcord examples -name "*.py") - sed -i -e 's/discord/selfcord/g' pyproject.toml MANIFEST.in - sed -i -e "s/prefix = 'discord'/prefix = 'selfcord'/" setup.py + sed -i -e 's/import discord/import selfcord/g' -e 's/from discord/from selfcord/g' -e 's/from discord/from selfcord/g' -e 's/discord\.py-self/selfcord\.py/g' -e '/\(discord\.com\|discord\.gg\|discord\.new\)/! s/discord\./selfcord\./g' $(find selfcord examples -name "*.py") + sed -i -e 's/discord/selfcord/g' pyproject.toml MANIFEST.in + sed -i -e "s/prefix = 'discord'/prefix = 'selfcord'/" setup.py - - name: Push changes - run: | - git add . - git stash - git switch renamed - git checkout stash -- . + - name: Push changes + run: | + git add . + git stash + git switch renamed + git checkout stash -- . - (git commit -am "Synchronize selfcord") || true - (git push origin renamed) || true + (git commit -am "Synchronize selfcord") || true + (git push origin renamed) || true diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index dbd00a907..a1208aee4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,4 @@ -name: test +name: Test on: push: @@ -8,21 +8,16 @@ on: jobs: pytest: runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - python-version: [ '3.8' ] - - name: pytest steps: - - uses: actions/checkout@v2 + - name: Checkout repository + uses: actions/checkout@v2 with: fetch-depth: 0 - - name: Set up CPython ${{ matrix.python-version }} + - name: Set up CPython 3.8 uses: actions/setup-python@v2 with: - python-version: ${{ matrix.python-version }} + python-version: '3.8' - name: Install dependencies run: |