Skip to content

Commit

Permalink
Test ci/cd
Browse files Browse the repository at this point in the history
  • Loading branch information
RubelMozumder committed Sep 30, 2024
1 parent 5d80d0e commit b4dfe5c
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 31 deletions.
71 changes: 41 additions & 30 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,24 @@

name: Upload Python Package

# on:
# release:
# types: [published]
on:
release:
types: [published]

push:
branches:
- '**'
env:
UV_SYSTEM_PYTHOn: true
jobs:
deploy:
name: Release on PyPI
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/pynxtools
permissions:
id-token: write

steps:
- uses: actions/checkout@v3
Expand All @@ -29,30 +40,30 @@ jobs:
python -m pip install --upgrade pip
curl -LsSf https://astral.sh/uv/install.sh | sh
uv pip install build
- name: Git tag version
id: git_tag_version
run: |
# Extract the version from the tag (e.g., 'v1.0.0' becomes '1.0.0')
GIT_TAG_VERSION=${GITHUB_REF#refs/tags/v}
echo "GIT_TAG_VERSION=$GIT_TAG_VERSION" >> $GITHUB_ENV
echo "Version from Git tag: $GIT_TAG_VERSION"
- name: Citation version
id: citation_version
run: |
# Parse the version from the CITATION.cff file
CITATION_VERSION=$(grep '^version:' CITATION.cff | cut -d' ' -f2)
echo "CITATION_VERSION=$CITATION_VERSION" >> $GITHUB_ENV
echo "Version from CITATION.cff: $CITATION_VERSION"
- name: Compare versions
run: |
if [ "$GIT_TAG_VERSION" != "$CITATION_VERSION" ]; then
echo "Version mismatch: Git tag version is $GIT_TAG_VERSION, CITATION.cff version is $CITATION_VERSION"
exit 1
fi
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
# - name: Git tag version
# id: git_tag_version
# run: |
# # Extract the version from the tag (e.g., 'v1.0.0' becomes '1.0.0')
# GIT_TAG_VERSION=${GITHUB_REF#refs/tags/v}
# echo "GIT_TAG_VERSION=$GIT_TAG_VERSION" >> $GITHUB_ENV
# echo "Version from Git tag: $GIT_TAG_VERSION"
# - name: Citation version
# id: citation_version
# run: |
# # Parse the version from the CITATION.cff file
# CITATION_VERSION=$(grep '^version:' CITATION.cff | cut -d' ' -f2)
# echo "CITATION_VERSION=$CITATION_VERSION" >> $GITHUB_ENV
# echo "Version from CITATION.cff: $CITATION_VERSION"
# - name: Compare versions
# run: |
# if [ "$GIT_TAG_VERSION" != "$CITATION_VERSION" ]; then
# echo "Version mismatch: Git tag version is $GIT_TAG_VERSION, CITATION.cff version is $CITATION_VERSION"
# exit 1
# fi
# - name: Build package
# run: python -m build
# - name: Publish package
# uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
# with:
# user: __token__
# password: ${{ secrets.PYPI_API_TOKEN }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/nyaml) [![PyPI](https://img.shields.io/pypi/v/nyaml)](https://pypi.org/project/nyaml/) [![Pytest](https://github.com/FAIRmat-NFDI/nyaml/actions/workflows/pytest.yaml/badge.svg)](https://github.com/FAIRmat-NFDI/nyaml/actions/workflows/pytest.yaml)[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1323437.svg)](not available yet)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/nyaml) [![PyPI](https://img.shields.io/pypi/v/nyaml)](https://pypi.org/project/nyaml/) [![Pytest](https://github.com/FAIRmat-NFDI/nyaml/actions/workflows/pytest.yaml/badge.svg)](https://github.com/FAIRmat-NFDI/nyaml/actions/workflows/pytest.yaml)[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1323437.svg)](10.5281/zenodo.13860810)

# Table of Contents

Expand Down

0 comments on commit b4dfe5c

Please sign in to comment.