Skip to content

Commit

Permalink
👷 add github workflows for ci and release.
Browse files Browse the repository at this point in the history
  • Loading branch information
perillaroc committed Oct 12, 2024
1 parent 80b7341 commit 8245212
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 5 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: release

on: push

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install pypa/build
run: >-
python -m pip install build --user
- name: Build a binary wheel and a source tarball
run: python -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/
75 changes: 75 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: release

#on: push

on:
release:
types: [published]

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install pypa/build
run: >-
python -m pip install build --user
- name: Build a binary wheel and a source tarball
run: python -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/

publish-to-pypi:
name: Publish python distribution to PyPI
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/cemc-plots-kit
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 PyPI
uses: pypa/gh-action-pypi-publish@release/v1

publish-to-testpypi:
name: Publish Python distribution to TestPyPI
needs:
- build
runs-on: ubuntu-latest

environment:
name: testpypi
url: https://test.pypi.org/p/cemc-plots-kit

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/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# cemc-plots-kit

CEMC 业务绘图工具
适用于 CEMC 数值天气预报模式数据的绘图工具

## LICENSE

Expand Down
8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name = "cemc-plots-kit"
authors = [
{name="Wang Dapeng", email="[email protected]"}
]
description = "Plots tool in CEMC."
description = "Plots tool for CEMC's NWP Opearting systems."
readme = "README.md"
keywords = ["graphic", "cemc", "cedarkit"]
license = { text = "Apache-2.0" }
Expand All @@ -33,12 +33,12 @@ dependencies = [
"reki>=2024.4.0",
"cedarkit-comp>=2024.4.0",
"cedarkit-maps>=2024.4.0",
"cedar-graph",
"cedar-graph>=2024.10.0",
]

[project.urls]
Homepage = "http://codingcorp.mc.met.cma/public/cedarkit/cemc-plots-kit/git/files/"
Repository = "http://e.mc.met.cma/codingcorp/cedarkit/cemc-plots-kit.git"
Homepage = "https://github.com/cemc-oper/cemc-plots-kit"
Repository = "https://github.com/cemc-oper/cemc-plots-kit.git"

[project.optional-dependencies]
test = ["pytest"]
Expand Down

0 comments on commit 8245212

Please sign in to comment.