diff --git a/.github/workflows/github-release.yml b/.github/workflows/github-release.yml new file mode 100644 index 0000000..96063b7 --- /dev/null +++ b/.github/workflows/github-release.yml @@ -0,0 +1,41 @@ +name: Create Github Release + +on: + push: + tags: + - "*.*.*" + - "*.*.*-alpha.*" + - "*.*.*-beta.*" + - "*.*.*-rc.*" + +jobs: + run_tests: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.8", "3.9", "3.10", "3.11"] + os: [ubuntu-latest] + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install poetry + poetry install + - name: Run tests + run: poetry run python tom_fink/tests/run_tests.py + + create_release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + draft: true diff --git a/.github/workflows/pypi-release.yml b/.github/workflows/pypi-release.yml new file mode 100644 index 0000000..40167fd --- /dev/null +++ b/.github/workflows/pypi-release.yml @@ -0,0 +1,29 @@ +name: Release to PyPi + +on: + release: + types: [published] + +jobs: + publish_to_pypi: + runs-on: ubuntu-latest + environment: release # configured in repo Settings/Environments; referenced in PyPI OIDC + permissions: + id-token: write # IMPORTANT: this permission is mandatory for trusted publishing + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: '3.11' # numpy is a problem with 3.12 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install poetry + poetry config virtualenvs.create false # tell poetry not to create a new virtual environment + poetry self add "poetry-dynamic-versioning[plugin]" + - name: Build package with poetry + run: | + poetry build -f wheel + poetry build -f sdist + - name: Publish to PyPI with pypi-publish (trusted publishing) + uses: pypa/gh-action-pypi-publish@v1.8.5