diff --git a/.github/workflows/build_main.yaml b/.github/workflows/build_main.yaml new file mode 100644 index 0000000..6e86179 --- /dev/null +++ b/.github/workflows/build_main.yaml @@ -0,0 +1,54 @@ +name: Build schemas + +# when main changed rebuild the products (schemas and documentations) and updates the build folder +on: + push: + branches: [ main ] + +permissions: write-all + +jobs: + build-and-publish: + name: Build main branch + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [ '3.9' ] + steps: + + - uses: actions/checkout@v3 + with: + persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token. + fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Install Poetry + run: | + curl -sSL https://install.python-poetry.org | python3 - + + - name: Install dependencies + run: | + poetry install + + - name: Generate merged schemas + run: | + cp src/cell_annotation_schema/schema/cell_annotation_schema.yaml build/general_schema.yaml + gen-linkml src/cell_annotation_schema/schema/BICAN/BICAN_schema.yaml --output build/BICAN_schema.yaml --mergeimports --format yaml --no-materialize-attributes + gen-linkml src/cell_annotation_schema/schema/CAP/CAP_schema.yaml --output build/CAP_schema.yaml --mergeimports --format yaml --no-materialize-attributes + + + - name: Commit files + run: | + git config --local user.email "github-actions[bot]@users.noreply.github.com" + git config --local user.name "github-actions[bot]" + git diff --quiet && git diff --staged --quiet || git commit -a -m "Main branch build" + + - name: Push changes + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.P_TOKEN }} + branch: ${{ github.head_ref }} diff --git a/.github/workflows/nightly_snapshot.yaml b/.github/workflows/nightly_snapshot.yaml new file mode 100644 index 0000000..ec0d8c8 --- /dev/null +++ b/.github/workflows/nightly_snapshot.yaml @@ -0,0 +1,56 @@ +name: Nightly Snapshot + +on: + schedule: + - cron: "59 23 * * *" + workflow_dispatch: + +permissions: + contents: write + +jobs: + tag: + name: Make snapshot release + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [ '3.9' ] + steps: + - name: Get current date + id: date + run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT + + - name: Checkout Repository + uses: actions/checkout@v3 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Install Poetry + run: | + curl -sSL https://install.python-poetry.org | python3 - + + - name: Install dependencies + run: | + poetry install + + - name: Generate merged schemas + run: | + cp src/cell_annotation_schema/schema/cell_annotation_schema.yaml build/general_schema.yaml + gen-linkml src/cell_annotation_schema/schema/BICAN/BICAN_schema.yaml --output build/BICAN_schema.yaml --mergeimports --format yaml --no-materialize-attributes + gen-linkml src/cell_annotation_schema/schema/CAP/CAP_schema.yaml --output build/CAP_schema.yaml --mergeimports --format yaml --no-materialize-attributes + + - name: Make Snapshot + uses: ncipollo/release-action@v1 + with: + artifacts: "build/general_schema.yaml, + build/BICAN_schema.yaml,build/CAP_schema.yaml" + body: "Nightly snapshot release. Draft only, please use a stable release instead." + allowUpdates: true + draft: true + makeLatest: false + name: "${{ steps.date.outputs.date }} SNAPSHOT" + removeArtifacts: true + tag: "snapshot" diff --git a/.github/workflows/pypi-publish.yaml b/.github/workflows/pypi-publish.yaml index 22d5a69..700b5ce 100644 --- a/.github/workflows/pypi-publish.yaml +++ b/.github/workflows/pypi-publish.yaml @@ -23,14 +23,31 @@ jobs: pipx install poetry poetry self add "poetry-dynamic-versioning[plugin]" - # - name: Install dependencies - # run: poetry install --no-interaction + - name: Install dependencies + run: poetry install --no-interaction + + - name: Generate merged schemas + run: | + cp src/cell_annotation_schema/schema/cell_annotation_schema.yaml build/general_schema.yaml + gen-linkml src/cell_annotation_schema/schema/BICAN/BICAN_schema.yaml --output build/BICAN_schema.yaml --mergeimports --format yaml --no-materialize-attributes + gen-linkml src/cell_annotation_schema/schema/CAP/CAP_schema.yaml --output build/CAP_schema.yaml --mergeimports --format yaml --no-materialize-attributes + + - name: Package release assets + run: | + mkdir -p src/cell_annotation_schema/schemas + touch src/cas_schema/schemas/__init__.py + cp build/general_schema.yaml src/cell_annotation_schema/schemas + cp build/BICAN_schema.yaml src/cell_annotation_schema/schemas + cp build/CAP_schema.yaml src/cell_annotation_schema/schemas + + - name: Update package version + run: | + sed -i 's/__version__/${{ github.ref_name }}/g' pyproject.toml - name: Build source and wheel archives run: poetry build - - name: Publish distribution 📦 to PyPI - uses: pypa/gh-action-pypi-publish@v1.2.2 + - name: Publish Package + uses: pypa/gh-action-pypi-publish@release/v1 with: - user: __token__ - password: ${{ secrets.PYPI_PASSWORD }} + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/pypi-test-publish.yaml b/.github/workflows/pypi-test-publish.yaml new file mode 100644 index 0000000..a6aec01 --- /dev/null +++ b/.github/workflows/pypi-test-publish.yaml @@ -0,0 +1,54 @@ +--- +name: Publish Python Package + +on: + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + build-n-publish: + name: Build and publish Python 🐍 distributions 📦 to PyPI + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: 3.9 + + - name: Install Poetry + run: | + pipx install poetry + poetry self add "poetry-dynamic-versioning[plugin]" + + - name: Install dependencies + run: poetry install --no-interaction + + - name: Generate merged schemas + run: | + cp src/cell_annotation_schema/schema/cell_annotation_schema.yaml build/general_schema.yaml + gen-linkml src/cell_annotation_schema/schema/BICAN/BICAN_schema.yaml --output build/BICAN_schema.yaml --mergeimports --format yaml --no-materialize-attributes + gen-linkml src/cell_annotation_schema/schema/CAP/CAP_schema.yaml --output build/CAP_schema.yaml --mergeimports --format yaml --no-materialize-attributes + + - name: Package release assets + run: | + mkdir -p src/cell_annotation_schema/schemas + touch src/cas_schema/schemas/__init__.py + cp build/general_schema.yaml src/cell_annotation_schema/schemas + cp build/BICAN_schema.yaml src/cell_annotation_schema/schemas + cp build/CAP_schema.yaml src/cell_annotation_schema/schemas + + - name: Update package version + run: | + sed -i 's/__version__/${{ github.ref_name }}/g' pyproject.toml + + - name: Build source and wheel archives + run: poetry build + + - name: Publish Package + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/ + password: ${{ secrets.TEST_PYPI_API_TOKEN }} diff --git a/pyproject.toml b/pyproject.toml index 639c70b..1a04b8c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "cell_annotation_schema" -version = "1.1.0" +version = "__version__" description = "General, open-standard schema for cell annotations" authors = ["Huseyin Kir "] license = "GNU GPL v3.0"