-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
26 additions
and
23 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,10 +17,10 @@ on: | |
workflow_dispatch: {} | ||
|
||
jobs: | ||
Lint: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v5 | ||
- uses: DeterminateSystems/nix-installer-action@main | ||
- uses: DeterminateSystems/magic-nix-cache-action@main | ||
- name: Load dependency cache | ||
|
@@ -29,21 +29,22 @@ jobs: | |
with: | ||
path: .venv | ||
key: app-${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('poetry.lock') }} | ||
- uses: nicknovitski/nix-develop@v1 | ||
- name: Install dependencies | ||
run: | | ||
nix develop -c poetry config virtualenvs.in-project true | ||
nix develop -c poetry install | ||
poetry config virtualenvs.in-project true | ||
poetry install | ||
if: steps.load-cache.outputs.cache-hit != 'true' | ||
- name: Check code style | ||
if: github.event_name != 'push' | ||
run: | | ||
nix develop -c poetry run black --check --diff . | ||
nix develop -c poetry run isort --check --diff . | ||
poetry run black --check --diff . | ||
poetry run isort --check --diff . | ||
- name: Reformat code | ||
if: github.event_name == 'push' | ||
run: | | ||
nix develop -c poetry run black . | ||
nix develop -c poetry run isort . | ||
poetry run black . | ||
poetry run isort . | ||
- name: Commit chanes | ||
if: github.event_name == 'push' | ||
shell: bash | ||
|
@@ -57,13 +58,13 @@ jobs: | |
git commit -m "style: reformat [skip ci]" | ||
git push | ||
Release: | ||
release: | ||
concurrency: release | ||
needs: Lint | ||
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@v3 | ||
- uses: actions/checkout@v5 | ||
with: | ||
fetch-depth: 0 | ||
- uses: DeterminateSystems/nix-installer-action@main | ||
|
@@ -74,43 +75,45 @@ jobs: | |
with: | ||
path: .venv | ||
key: app-${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('poetry.lock') }} | ||
- uses: nicknovitski/nix-develop@v1 | ||
- name: Install dependencies | ||
run: | | ||
nix develop -c poetry config virtualenvs.in-project true | ||
nix develop -c poetry install --with release | ||
poetry config virtualenvs.in-project true | ||
poetry install --with release | ||
if: steps.load-cache.outputs.cache-hit != 'true' | ||
|
||
- name: Release | ||
- 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 "[email protected]" | ||
export GH_TOKEN="${GITHUB_TOKEN}" | ||
export REPOSITORY_USERNAME="__token__" | ||
export REPOSITORY_PASSWORD="${PYPI_TOKEN}" | ||
python -m semantic_release publish -D commit_author="github-actions <[email protected]>" | ||
python -m semantic_release version | ||
- name: Publish package distributions to GitHub Releases | ||
uses: python-semantic-release/[email protected] | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
- 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 | ||
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: | ||
build-release-docker: | ||
name: Build release docker image | ||
needs: Release | ||
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 }} | ||
commit-hash: ${{ needs.release.outputs.release-commit-hash }} | ||
secrets: inherit |