Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(ci): tweak github actions #8

Merged
merged 1 commit into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set the release version
shell: bash
run: echo "RELEASE_VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV
Expand Down Expand Up @@ -94,7 +95,6 @@ jobs:
AZURE_DEVOPS_TOKEN: ${{ secrets.AZURE_DEVOPS_TOKEN }}
AZURE_ARTIFACTS_FEED_URL: ${{ secrets.AZURE_ARTIFACTS_FEED_URL }}


- name: Promote to Release on AzureDevops Artifact
# TODO: implement promotion
if: ${{ !contains(github.ref, '-') }}
Expand Down
79 changes: 2 additions & 77 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,85 +30,10 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install hatch
run: |
python -m pip install hatch
- name: Install Hatch
run: pip install -U hatch

- name: Tests
run: hatch run +py=${{ matrix.python-version }} test:test

release-build:
name: Build release distributions 🔨👷
needs: test
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-python@v5
with:
python-version: "3.x"

- name: Install hatch
run: |
python -m pip install hatch

- name: Build release distributions
run: |
# NOTE: put your own distribution build steps here.
python -m pip install hatch
python -m hatch build

- name: Upload distributions
uses: actions/upload-artifact@v4
with:
name: release-dists
path: dist/

- name: Publish
run: |
err=$(hatch publish -r $AZURE_ARTIFACTS_FEED_URL -u 'GitHubAction' -a $AZURE_DEVOPS_TOKEN 2>&1 >/dev/null || true)
if [[ -z "$err" ]]; then
exit 0
elif [[ "$err" == *"409"* ]]; then
echo Marking run as success. This version is already published.
echo $err
exit 0
fi
env:
AZURE_DEVOPS_TOKEN: ${{ secrets.AZURE_DEVOPS_TOKEN }}
AZURE_ARTIFACTS_FEED_URL: ${{ secrets.AZURE_ARTIFACTS_FEED_URL }}

changelog:
name: Generate changelog
needs: test
if: ${{ contains(github.ref_name, 'trunk') }}
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Generate changelog
uses: orhun/git-cliff-action@v4
with:
config: cliff.toml
args: --verbose
env:
OUTPUT: CHANGELOG.md
GITHUB_REPO: ${{ github.repository }}

- name: Commit
run: |
git checkout $MAIN_BRANCH
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
set +e
git add CHANGELOG.md
git commit -m "chore: update changelog" -m "[skip ci]"
git push https://${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git $MAIN_BRANCH
76 changes: 0 additions & 76 deletions .github/workflows/coverage.yml

This file was deleted.

8 changes: 5 additions & 3 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,12 @@ jobs:
with:
python-version: '3.11'

- name: Install Hatch
run: pip install -U hatch

- run: |
pip install mkdocs-material mkdocs-git-revision-date-localized-plugin mkdocstrings mkdocstrings-python
pip install -e .
mkdocs build
hatch env create docs
hatch run docs:build
name: Install docs dependencies and build static files

- name: Login to ECR
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ extra-dependencies = [
[tool.hatch.envs.dev.scripts]
install = "pre-commit install --hook-type commit-msg"
version = "versioningit"
changelog = "towncrier"
changelog = "git-cliff -o CHANGELOG.md"

[tool.hatch.envs.types]
extra-dependencies = [
Expand Down
Loading