move swe path into Data instance #62
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
ci: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: snok/install-poetry@v1 | |
with: | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
installer-parallel: true | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
cache: "poetry" | |
- run: | | |
poetry install --with dev | |
# avoid activate evn in every step | |
echo "$GITHUB_WORKSPACE/.venv/bin" >> $GITHUB_PATH | |
- id: test | |
run: pytest | |
- id: check_version | |
run: | | |
pyproject_version=$(poetry version -s) | |
repo_name="${GITHUB_REPOSITORY#*/}" | |
latest_release=$(gh api repos/$GITHUB_REPOSITORY/releases/latest --jq .tag_name) | |
if [ "$(printf '%s\n' "$latest_release" "$pyproject_version" | sort -V | tail -n1)" = "$pyproject_version" ] && [ "$pyproject_version" != "$latest_release" ]; then | |
echo "new_version=$pyproject_version" >> $GITHUB_OUTPUT | |
fi | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- id: build | |
if: steps.check_version.outputs.new_version != '' | |
run: poetry build | |
- id: pump | |
if: steps.build.conclusion == 'success' | |
run: | | |
git config --global user.email "hoishing@gmail.com" | |
git config --global user.name "Kelvin Ng" | |
git tag ${{ steps.check_version.outputs.new_version }} | |
git push --tag -f | |
- id: release | |
if: steps.pump.conclusion == 'success' | |
run: | | |
latest_tag=${{ steps.check_version.outputs.new_version }} | |
gh release create "$latest_tag" --generate-notes ./dist/* | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- id: publish | |
if: steps.release.conclusion == 'success' | |
run: | | |
poetry config pypi-token.pypi ${{ secrets.PYPI_API_TOKEN }} | |
poetry publish | |
- id: deploy_docs | |
if: steps.publish.conclusion == 'success' | |
run: mkdocs gh-deploy --force |