Skip to content

Commit 4e874c6

Browse files
authored
Merge pull request #98 from hmasdev/update-github-actions
Update-github-actions
2 parents e700052 + c601d0f commit 4e874c6

7 files changed

+68
-62
lines changed

.github/workflows/code-style-check-workflow-call.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ jobs:
2020
strategy:
2121
matrix:
2222
python-version: [3.9, "3.10", "3.11", "3.12"]
23+
permissions:
24+
contents: read
2325
steps:
2426
- uses: actions/checkout@v3
2527
with:

.github/workflows/on_push_tags.yaml

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,15 @@ jobs:
1414
needs: [validate-version]
1515
if: ${{ failure() }}
1616
runs-on: ubuntu-latest
17-
env:
18-
PRIVATE_REPO_USER: "hmasdev"
19-
strategy:
20-
matrix:
21-
python-version: [3.9]
17+
permissions:
18+
contents: write
19+
pull-requests: write
2220
steps:
2321
- uses: actions/checkout@v4
24-
- name: Set up Python ${{ matrix.python-version }}
25-
uses: actions/setup-python@v1
22+
- name: Set up Python 3.11
23+
uses: actions/setup-python@v5
2624
with:
27-
python-version: ${{ matrix.python-version }}
25+
python-version: "3.11"
2826
- name: Update Tags
2927
run: |
3028
# Get the latest tag
@@ -70,13 +68,11 @@ jobs:
7068
--assignee hmasdev \
7169
--reviewer hmasdev \
7270
--label "bot"
73-
7471
env:
75-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
76-
72+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7773
- name: Create a Draft Release
7874
shell: bash
7975
run: |
8076
gh release create $tag --title "Release $tag" --notes "Release $tag" --draft
8177
env:
82-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
78+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/on_release.yaml

Lines changed: 44 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -21,53 +21,58 @@ jobs:
2121
uses: ./.github/workflows/validate-version-workflow-call.yaml
2222
with:
2323
git-ref: ${{ github.ref }}
24-
deploy:
24+
build:
2525
needs: [test, static-type-check, code-style-check, validate-version]
2626
runs-on: ubuntu-latest
27-
env:
28-
PRIVATE_REPO_USER: "hmasdev"
29-
strategy:
30-
matrix:
31-
python-version: [3.9]
27+
permissions:
28+
contents: read
3229
steps:
33-
- uses: actions/checkout@v1
34-
- name: Set up Python ${{ matrix.python-version }}
35-
uses: actions/setup-python@v1
30+
- uses: actions/checkout@v4
31+
- name: Set up Python 3.11
32+
uses: actions/setup-python@v5
3633
with:
37-
python-version: ${{ matrix.python-version }}
38-
- name: Install requirements
34+
python-version: "3.11"
35+
- name: Install dependencies
3936
run: |
40-
python -m pip install --upgrade pip wheel setuptools twine
41-
python -m pip install uv
42-
uv sync --dev
43-
- name: Build
37+
python -m pip install --upgrade pip
38+
pip install -U uv
39+
- name: Build a binary wheel and a source tarball
4440
run: |
4541
uv build
46-
echo "whl_name=$(ls dist/*whl | cut -d / -f 2)" >> $GITHUB_ENV
47-
echo "tar_name=$(ls dist/*tar.gz | cut -d / -f 2)" >> $GITHUB_ENV
48-
- name: Upload Wheel to GitHub
49-
uses: actions/upload-release-asset@v1
42+
- name: Store the distribution files as artifacts
43+
uses: actions/upload-artifact@v4
5044
with:
51-
upload_url: ${{ github.event.release.upload_url }}
52-
asset_path: ./dist/*.whl
53-
asset_name: ${{ env.whl_name }}
54-
asset_content_type: application/octet-stream
55-
env:
56-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57-
- name: Upload tar.gz to GitHub
58-
uses: actions/upload-release-asset@v1
45+
name: python-package-distributions
46+
path: dist/
47+
publish-to-pypi:
48+
needs: [build]
49+
runs-on: ubuntu-latest
50+
environment:
51+
name: pypi
52+
url: https://pypi.org/p/pyjpboatrace
53+
permissions:
54+
id-token: write
55+
steps:
56+
- name: Download the distribution files
57+
uses: actions/download-artifact@v4
5958
with:
60-
upload_url: ${{ github.event.release.upload_url }}
61-
asset_path: ./dist/*.tar.gz
62-
asset_name: ${{ env.tar_name }}
63-
asset_content_type: application/octet-stream
59+
name: python-package-distributions
60+
path: dist/
61+
- name: Publish distribution to PyPI
62+
uses: pypa/gh-action-pypi-publish@release/v1
63+
publish-to-github:
64+
needs: [build]
65+
runs-on: ubuntu-latest
66+
permissions:
67+
contents: write
68+
steps:
69+
- name: Download the distribution files
70+
uses: actions/download-artifact@v4
71+
with:
72+
name: python-package-distributions
73+
path: dist/
74+
- name: Upload distribution files to GitHub
6475
env:
65-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66-
- name: Upload to PyPI
76+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6777
run: |
68-
uv run python -m twine upload --repository pypi dist/*
69-
env:
70-
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
71-
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
72-
TWINE_REPOSITORY_URL: https://upload.pypi.org/legacy/
73-
TWINE_SKIP_EXISTING: true
78+
gh release upload "$GITHUB_REF_NAME" dist/* --repo "$GITHUB_REPOSITORY" --clobber

.github/workflows/pytest-workflow-call.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ jobs:
2020
strategy:
2121
matrix:
2222
python-version: [3.9, "3.10", "3.11", "3.12"]
23+
permissions:
24+
contents: read
2325
steps:
2426
- uses: actions/checkout@v3
2527
with:

.github/workflows/static-type-check-workflow-call.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ jobs:
2020
strategy:
2121
matrix:
2222
python-version: [3.9, "3.10", "3.11", "3.12"]
23+
permissions:
24+
contents: read
2325
steps:
2426
- uses: actions/checkout@v3
2527
with:

.github/workflows/update-readme.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@ env:
1111
jobs:
1212
update-readme:
1313
runs-on: ubuntu-latest
14+
permissions:
15+
pull-requests: write
1416
steps:
1517
- uses: actions/checkout@v4
1618
- name: Setup Python 3.11
17-
uses: actions/setup-python@v4
19+
uses: actions/setup-python@v5
1820
with:
1921
python-version: "3.11"
2022
- name: Install dependencies
@@ -61,5 +63,5 @@ jobs:
6163
--assignee hmasdev \
6264
--label "bot"
6365
env:
64-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6567
GITHUB_RUN_ID: ${{ github.run_id }}

.github/workflows/validate-version-workflow-call.yaml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,16 @@ on:
1717
jobs:
1818
validate_version:
1919
runs-on: ubuntu-latest
20-
env:
21-
PRIVATE_REPO_USER: "hmasdev"
22-
strategy:
23-
matrix:
24-
python-version: [3.9]
20+
permissions:
21+
contents: read
2522
steps:
26-
- uses: actions/checkout@v3
23+
- uses: actions/checkout@v4
2724
with:
2825
ref: ${{ inputs.git-ref }}
29-
- name: Set up Python ${{ matrix.python-version }}
30-
uses: actions/setup-python@v1
26+
- name: Set up Python 3.11
27+
uses: actions/setup-python@v5
3128
with:
32-
python-version: ${{ matrix.python-version }}
29+
python-version: "3.11"
3330
- name: Install requirements
3431
run: |
3532
python -m pip install --upgrade pip

0 commit comments

Comments
 (0)