Skip to content

Commit

Permalink
Move release CI to separate file (#807)
Browse files Browse the repository at this point in the history
  • Loading branch information
davfsa committed Sep 30, 2021
1 parent 327673b commit 83f9403
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 50 deletions.
48 changes: 0 additions & 48 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ name: CI
on:
push:
pull_request:
release:
types: [published]

jobs:
test:
Expand Down Expand Up @@ -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
49 changes: 49 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions pipelines/format.nox.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 83f9403

Please sign in to comment.