Skip to content

Commit

Permalink
prepare new release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
floriscalkoen committed Jul 5, 2024
1 parent d93cbb9 commit 84022a7
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 19 deletions.
5 changes: 4 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
# also see
# https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/configuration-options-for-dependency-updates

version: 2
updates:
# Maintain dependencies for GitHub Actions
# Workflow files in .github/workflows will be checked
- package-ecosystem: "github-actions"
directory: "/"
schedule:
# Check for updates to GitHub Actions every week
interval: "weekly"

Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
name: Publish package to pypi
name: Release

on:
push:
branches: [main]
paths:
- "src/coastpy/**"
release:
types:
- created
workflow_dispatch:

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
Expand All @@ -16,21 +18,29 @@ defaults:
shell: bash -l {0}

jobs:
build_and_publish:
check-package:
name: Build & inspect our package.
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Micromamba
uses: mamba-org/setup-micromamba@v1
with:
environment-file: ci/envs/312-release-package.yaml
fetch-depth: 0
- uses: hynek/build-and-inspect-python-package@v2

release-pypi:
permissions:
id-token: write
contents: read
name: Publish released package to pypi.org
runs-on: ubuntu-latest
needs: check-package

# NOTE: 'poetry install' because we assume all packages are available in the release env
- name: Build package
run: |
poetry build
steps:
- name: Download packages built by build-and-inspect-python-package
uses: actions/download-artifact@v4
with:
name: Packages
path: dist

- name: Publish package distributions to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
Expand All @@ -39,9 +49,8 @@ jobs:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository-url: https://test.pypi.org/legacy/

# Publish to PyPI
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
password: ${{ secrets.PYPI_TOKEN }}
File renamed without changes.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Homepage = "https://github.com/florisCalkoen/coastpy"
source = "vcs"

[tool.hatch.build.hooks.vcs]
version-file = "src/coastpy/_version.py"
version-file = "src/coastpy/__init__.py"

[tool.ruff]
line-length = 88
Expand Down

0 comments on commit 84022a7

Please sign in to comment.