From 83f94039fecd0c77e5ddcc3623ce6738e74f4fc6 Mon Sep 17 00:00:00 2001 From: davfsa Date: Thu, 30 Sep 2021 21:06:58 +0200 Subject: [PATCH] Move release CI to separate file (#807) --- .github/workflows/ci.yml | 48 ---------------------------------- .github/workflows/release.yml | 49 +++++++++++++++++++++++++++++++++++ pipelines/format.nox.py | 4 +-- 3 files changed, 51 insertions(+), 50 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0db5e025ed..2f27d3b54b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,8 +3,6 @@ name: CI on: push: pull_request: - release: - types: [published] jobs: test: @@ -179,49 +177,3 @@ jobs: else exit 1 fi - - deploy: - if: github.event_name == 'release' - needs: [ci-done] - - runs-on: ubuntu-latest - - steps: - - name: Checkout repo - uses: actions/checkout@v2.3.4 - with: - token: ${{ secrets.PAT_TOKEN }} - - - name: Setup python - uses: actions/setup-python@v2.2.2 - with: - python-version: 3.8 - - - name: Setup git config - run: | - git config --global user.name "hikari-bot" - git config --global user.email "90276125+hikari-bot[bot]@users.noreply.github.com" - - - name: Temporarily disable "include administrators" branch protection - uses: benjefferies/branch-protection-bot@master - with: - access_token: ${{ secrets.PAT_TOKEN }} - enforce_admins: false - - - name: Deploy - env: - GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }} - VERSION: ${{ github.event.release.tag_name }} - REF: ${{ github.sha }} - GITHUB_REPO_SLUG: ${{ github.repository }} - DEPLOY_WEBHOOK_URL: ${{ secrets.DEPLOY_WEBHOOK_URL }} - TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }} - TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} - run: bash scripts/deploy.sh - - - name: Re-enable "include administrators" branch protection - uses: benjefferies/branch-protection-bot@master - if: always() - with: - access_token: ${{ secrets.PAT_TOKEN }} - enforce_admins: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000000..27438dfbd8 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,49 @@ +name: Release + +on: + release: + types: [published] + +jobs: + release: + runs-on: ubuntu-latest + + steps: + - name: Checkout repo + uses: actions/checkout@v2.3.4 + with: + token: ${{ secrets.PAT_TOKEN }} + + - name: Setup python + uses: actions/setup-python@v2.2.2 + with: + python-version: 3.8 + + - name: Setup git config + run: | + git config --global user.name "hikari-bot" + git config --global user.email "90276125+hikari-bot[bot]@users.noreply.github.com" + + - name: Temporarily disable "include administrators" branch protection + uses: benjefferies/branch-protection-bot@master + with: + access_token: ${{ secrets.PAT_TOKEN }} + enforce_admins: false + + - name: Deploy + env: + GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }} + VERSION: ${{ github.event.release.tag_name }} + REF: ${{ github.sha }} + GITHUB_REPO_SLUG: ${{ github.repository }} + DEPLOY_WEBHOOK_URL: ${{ secrets.DEPLOY_WEBHOOK_URL }} + TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }} + TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} + run: bash scripts/deploy.sh + + - name: Re-enable "include administrators" branch protection + uses: benjefferies/branch-protection-bot@master + if: always() + with: + access_token: ${{ secrets.PAT_TOKEN }} + enforce_admins: true diff --git a/pipelines/format.nox.py b/pipelines/format.nox.py index 7badbef423..0498b37ac0 100644 --- a/pipelines/format.nox.py +++ b/pipelines/format.nox.py @@ -101,10 +101,10 @@ def remove_trailing_whitespaces_for_file(file: str, session: nox.Session, check_ return False if check_only: - session.log("Trailing whitespaces found in", file) + session.log(f"Trailing whitespaces found in {file}") return True - session.log("Removing trailing whitespaces present in", file) + session.log(f"Removing trailing whitespaces present in {file}") with open(file, "wb") as fp: fp.writelines(new_lines)