From 0d078b786da06b84635af2ba83cb8a31510e41cd Mon Sep 17 00:00:00 2001 From: Tsuyoshi Hombashi Date: Tue, 30 Apr 2024 16:53:48 +0900 Subject: [PATCH] Fix workflows Signed-off-by: Tsuyoshi Hombashi --- .github/workflows/ci.yml | 33 ++++++++++++------ .github/workflows/publish.yml | 66 +++++++++++++++++++++++++---------- 2 files changed, 70 insertions(+), 29 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fcd775b..77cd42f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,18 +18,31 @@ jobs: concurrency: group: ${{ github.event_name }}-${{ github.workflow }}-${{ github.ref_name }}-build-pkg cancel-in-progress: true - container: - image: ghcr.io/thombashi/python-ci:3.11 + timeout-minutes: 20 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + fetch-tags: true + + - uses: actions/setup-python@v5 + with: + python-version: "3.11" + cache: pip + cache-dependency-path: | + setup.py + **/*requirements.txt + tox.ini - - run: make build + - run: make setup-ci - - uses: actions/upload-artifact@v4 - with: - name: dist - path: ./dist/* + - run: make build + + - uses: actions/upload-artifact@v4 + with: + name: dist + path: ./dist/* publish-package: needs: build-package @@ -37,7 +50,7 @@ jobs: concurrency: group: ${{ github.event_name }}-${{ github.workflow }}-${{ github.ref_name }}-publish-pkg cancel-in-progress: true - timeout-minutes: 20 + timeout-minutes: 10 environment: name: testpypi url: https://pypi.org/p/DateTimeRange @@ -62,7 +75,7 @@ jobs: concurrency: group: ${{ github.event_name }}-${{ github.workflow }}-${{ github.ref_name }}-sign-pkg cancel-in-progress: true - timeout-minutes: 20 + timeout-minutes: 10 permissions: id-token: write diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 86649c9..983edbd 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -8,22 +8,36 @@ on: jobs: build-package: runs-on: ubuntu-latest - container: - image: ghcr.io/thombashi/python-ci:3.11 + timeout-minutes: 20 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + fetch-tags: true - - run: make build + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + cache: pip + cache-dependency-path: | + setup.py + **/*requirements.txt + tox.ini - - uses: actions/upload-artifact@v4 - with: - name: dist - path: ./dist/* + - run: make setup-ci + + - run: make build + + - uses: actions/upload-artifact@v4 + with: + name: dist + path: ./dist/* publish-package: needs: build-package runs-on: ubuntu-latest + timeout-minutes: 10 environment: name: pypi url: https://pypi.org/p/DateTimeRange @@ -40,15 +54,29 @@ jobs: - name: Publish to PyPI uses: pypa/gh-action-pypi-publish@release/v1 - - name: Sign the dists with Sigstore - uses: sigstore/gh-action-sigstore-python@v2.1.1 - with: - inputs: >- - ./dist/*.tar.gz - ./dist/*.whl + generate-relese: + needs: publish-package + runs-on: ubuntu-latest + timeout-minutes: 10 + permissions: + id-token: write + contents: write - - name: Generate a GitHub release - uses: softprops/action-gh-release@v2 - with: - generate_release_notes: true - files: dist/* + steps: + - uses: actions/download-artifact@v4 + with: + name: dist + path: ./dist + + - name: Sign the dists with Sigstore + uses: sigstore/gh-action-sigstore-python@v2.1.1 + with: + inputs: >- + ./dist/*.tar.gz + ./dist/*.whl + + - name: Generate a GitHub release + uses: softprops/action-gh-release@v2 + with: + generate_release_notes: true + files: dist/*