refactor: reactions_fix.update_hash is now called in edit_message #191
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: Lint & release project | |
on: | |
push: | |
paths: | |
- 'pyproject.toml' | |
- 'poetry.lock' | |
- 'tgpy/**' | |
- '.github/workflows/main.yml' | |
- '.github/workflows/docker.yml' | |
pull_request: | |
paths: | |
- 'pyproject.toml' | |
- 'poetry.lock' | |
- 'tgpy/**' | |
- '.github/workflows/main.yml' | |
- '.github/workflows/docker.yml' | |
workflow_dispatch: {} | |
jobs: | |
Lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: '3.10' | |
- name: Install poetry | |
shell: bash | |
run: | | |
pip install poetry | |
poetry config virtualenvs.in-project true | |
- name: Load dependency cache | |
id: load-cache | |
uses: actions/cache@v2 | |
with: | |
path: .venv | |
key: app-${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('poetry.lock') }} | |
- name: Install dependencies | |
run: poetry install | |
if: steps.load-cache.outputs.cache-hit != 'true' | |
- name: Check code style | |
if: github.event_name != 'push' | |
run: | | |
poetry run black --check --diff . | |
poetry run isort --check --diff . | |
- name: Reformat code | |
if: github.event_name == 'push' | |
run: | | |
poetry run black . | |
poetry run isort . | |
- name: Commit chanes | |
if: github.event_name == 'push' | |
shell: bash | |
run: | | |
if [ ! -n "$(git status --porcelain)" ]; then | |
exit | |
fi | |
git add -A | |
git config user.name "github-actions" | |
git config user.email "action@github.com" | |
git commit -m "style: reformat [skip ci]" | |
git push | |
Release: | |
concurrency: release | |
needs: Lint | |
if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.ref == 'refs/heads/master' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: '3.10' | |
- name: Install poetry | |
shell: bash | |
run: | | |
pip install poetry | |
poetry config virtualenvs.in-project true | |
- name: Load dependency cache | |
id: load-cache | |
uses: actions/cache@v2 | |
with: | |
path: .venv | |
key: app-${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('poetry.lock') }} | |
- name: Release | |
shell: bash | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} | |
run: | | |
source .venv/bin/activate | |
git config --global user.name "github-actions" | |
git config --global user.email "action@github.com" | |
export GH_TOKEN="${GITHUB_TOKEN}" | |
export REPOSITORY_USERNAME="__token__" | |
export REPOSITORY_PASSWORD="${PYPI_TOKEN}" | |
python -m semantic_release publish -D commit_author="github-actions <action@github.com>" | |
- name: Save release commit hash | |
id: release-commit-hash | |
run: echo "::set-output name=release-commit-hash::$(git rev-parse HEAD)" | |
outputs: | |
release-commit-hash: ${{ steps.release-commit-hash.outputs.release-commit-hash }} | |
Build-dev-docker: | |
needs: Lint | |
name: Build dev docker image | |
if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.ref != 'refs/heads/master' | |
uses: ./.github/workflows/docker.yml | |
secrets: inherit | |
Build-release-docker: | |
name: Build release docker image | |
needs: Release | |
if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.ref == 'refs/heads/master' | |
uses: ./.github/workflows/docker.yml | |
with: | |
commit-hash: ${{ needs.Release.outputs.release-commit-hash }} | |
secrets: inherit | |