From 07f14e348d3995e2e7ed511d87599b8338d8fc20 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 19 Jan 2024 17:01:52 +0100 Subject: [PATCH] Used trusted publisher for PyPi (backport #88) (#134) Co-authored-by: Steve Wood <40241007+woodsp-ibm@users.noreply.github.com> --- .github/workflows/deploy-code.yml | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/.github/workflows/deploy-code.yml b/.github/workflows/deploy-code.yml index 2b16647f..5f9c9491 100644 --- a/.github/workflows/deploy-code.yml +++ b/.github/workflows/deploy-code.yml @@ -1,6 +1,6 @@ # This code is part of a Qiskit project. # -# (C) Copyright IBM 2021, 2022. +# (C) Copyright IBM 2021, 2023. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory @@ -20,6 +20,9 @@ on: jobs: code_publish: runs-on: ubuntu-latest + environment: release + permissions: + id-token: write strategy: matrix: python-version: [3.8] @@ -28,12 +31,12 @@ jobs: - uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} + - name: Install deps + run: pip install -U pip setuptools virtualenv wheel + - name: Build sdist + run: python3 setup.py sdist bdist_wheel + - uses: actions/upload-artifact@v3 + with: + path: ./dist/* - name: Deploy to Pypi - env: - TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} - TWINE_USERNAME: qiskit - run : | - pip install -U twine pip setuptools virtualenv wheel - python3 setup.py sdist bdist_wheel - twine upload dist/qiskit* - shell: bash + uses: pypa/gh-action-pypi-publish@release/v1