Skip to content

Merge branch 'main' of github.com:jhassine/django-ninja-crudl #8

Merge branch 'main' of github.com:jhassine/django-ninja-crudl

Merge branch 'main' of github.com:jhassine/django-ninja-crudl #8

Workflow file for this run

name: CI/CD pipeline
on:
push:
branches:
- "*"
jobs:
tests:
name: Run tests and checks
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Build Docker image
run: |
docker build -t django-ninja-crudl .
- name: Run tests
run: |
docker run --volume $(pwd):/app --workdir /app --rm django-ninja-crudl nox -s noop
release:
# If main branch is updated, we want to release the package.
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs:
- tests
concurrency: release
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
continue-on-error: true
outputs:
released: ${{ steps.release.outputs.released }}
steps:
# Note: we need to checkout the repository at the workflow sha in case during the workflow
# the branch was updated. To keep PSR working with the configured release branches,
# we force a checkout of the desired release branch but at the workflow sha HEAD.
- name: Setup | Checkout Repository at workflow sha
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.sha }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install pypa/build
run: >-
python3 -m
pip install
build
--user
- name: Setup | Force correct release branch on workflow sha
run: |
git checkout -B ${{ github.ref_name }} ${{ github.sha }}
- name: Action | Semantic Version Release
id: release
# Adjust tag with desired version if applicable.
uses: python-semantic-release/python-semantic-release@v9.14.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
git_committer_name: "github-actions"
git_committer_email: "actions@users.noreply.github.com"
root_options: "--strict"
- name: Build | Build the distribution packages
run: >-
python3 -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
path: dist/
name: python-package-distributions
- name: Publish | Upload to GitHub Release Assets
uses: python-semantic-release/publish-action@v9.14.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.release.outputs.tag }}
publish-to-testpypi:
name: Publish Python 🐍 distribution 📦 to TestPyPI
if: ${{ needs.release.outputs.released == 'true' }}
needs:
- release
runs-on: ubuntu-latest
environment:
name: testpypi
url: https://test.pypi.org/p/django-ninja-crudl
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/