diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000..f666ed2ec --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,10 @@ +--- +version: 2 +# update once a week, with a 7-day cooldown +updates: + - package-ecosystem: github-actions + directory: / + schedule: + interval: weekly + cooldown: + default-days: 7 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 027bc75f5..6ae29563a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,4 +1,6 @@ --- +permissions: + contents: read name: main concurrency: group: ${{ github.head_ref || github.run_id }} @@ -22,8 +24,10 @@ jobs: - '313' - '314' steps: - - uses: actions/checkout@v4 - - uses: prefix-dev/setup-pixi@v0.9.4 + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 + with: + persist-credentials: false + - uses: prefix-dev/setup-pixi@a0af7a228712d6121d37aba47adf55c1332c9c2e # v0.9.4 with: pixi-version: v0.65.0 cache: true @@ -35,7 +39,7 @@ jobs: run: pixi run -e tests-linux-py${{ matrix.python-version }} tests-with-cov - name: Upload coverage report. if: matrix.python-version == '312' - uses: codecov/codecov-action@v4 + uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0 with: token: ${{ secrets.CODECOV_TOKEN }} run-tests-win-and-mac: @@ -52,8 +56,10 @@ jobs: - '313' - '314' steps: - - uses: actions/checkout@v4 - - uses: prefix-dev/setup-pixi@v0.9.4 + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 + with: + persist-credentials: false + - uses: prefix-dev/setup-pixi@a0af7a228712d6121d37aba47adf55c1332c9c2e # v0.9.4 with: pixi-version: v0.65.0 cache: true @@ -67,8 +73,10 @@ jobs: name: Run tests on ubuntu-latest with plotly < 6 runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: prefix-dev/setup-pixi@v0.9.4 + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 + with: + persist-credentials: false + - uses: prefix-dev/setup-pixi@a0af7a228712d6121d37aba47adf55c1332c9c2e # v0.9.4 with: pixi-version: v0.65.0 cache: true @@ -89,8 +97,10 @@ jobs: - '313' - '314' steps: - - uses: actions/checkout@v4 - - uses: prefix-dev/setup-pixi@v0.9.4 + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 + with: + persist-credentials: false + - uses: prefix-dev/setup-pixi@a0af7a228712d6121d37aba47adf55c1332c9c2e # v0.9.4 with: pixi-version: v0.65.0 cache: true @@ -106,8 +116,10 @@ jobs: name: Run code snippets in documentation runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: prefix-dev/setup-pixi@v0.9.4 + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 + with: + persist-credentials: false + - uses: prefix-dev/setup-pixi@a0af7a228712d6121d37aba47adf55c1332c9c2e # v0.9.4 with: pixi-version: v0.65.0 cache: true @@ -123,8 +135,10 @@ jobs: name: Run mypy runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: prefix-dev/setup-pixi@v0.9.4 + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 + with: + persist-credentials: false + - uses: prefix-dev/setup-pixi@a0af7a228712d6121d37aba47adf55c1332c9c2e # v0.9.4 with: pixi-version: v0.65.0 cache: true diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml index 0f5933a33..430593c12 100644 --- a/.github/workflows/publish-to-pypi.yml +++ b/.github/workflows/publish-to-pypi.yml @@ -2,13 +2,17 @@ name: PyPI on: push jobs: - build-n-publish: - name: Build and publish optimagic Python 🐍 distributions 📦 to PyPI + build: + name: Build distribution runs-on: ubuntu-latest + permissions: + contents: read steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 + with: + persist-credentials: false - name: Set up Python 3.12 - uses: actions/setup-python@v5 + uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 with: python-version: '3.12' - name: Install pypa/build @@ -24,8 +28,25 @@ jobs: --sdist --wheel --outdir dist/ - - name: Publish distribution 📦 to PyPI - if: startsWith(github.ref, 'refs/tags') - uses: pypa/gh-action-pypi-publish@release/v1 + - name: Upload distribution artifacts + uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 + with: + name: dist + path: dist + publish: + name: Publish to PyPI + if: startsWith(github.ref, 'refs/tags') + needs: build + runs-on: ubuntu-latest + permissions: + id-token: write + steps: + - name: Download distribution artifacts + # yamllint disable-line rule:line-length + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: - password: ${{ secrets.PYPI_API_TOKEN_OPTIMAGIC }} + name: dist + path: dist + - name: Publish distribution to PyPI + # yamllint disable-line rule:line-length + uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0