Skip to content

Commit

Permalink
Merge pull request #4870 from dev-hato/update_uv
Browse files Browse the repository at this point in the history
uvアップデート
  • Loading branch information
massongit authored Feb 20, 2025
2 parents b2222e1 + 6e400a3 commit e83e673
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 5 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/deploy-hato-bot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,27 @@ on:
- master
- develop
jobs:
update-uv-version:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
if: github.event_name != 'pull_request' || github.event.action != 'closed'
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Get uv version
if: github.event_name != 'pull_request' || github.event.action != 'closed'
run: bash "${GITHUB_WORKSPACE}/scripts/deploy_hato_bot/update_uv_version/get_uv_version.sh"
env:
HEAD_REF: ${{github.head_ref || github.event.release.tag_name}}
- uses: dev-hato/actions-diff-pr-management@cea263ca46759ebc8c812b8595be4df129761037 # v2.1.0
with:
github-token: ${{secrets.GITHUB_TOKEN}}
branch-name-prefix: fix-uv-version
pr-title-prefix: uvのバージョンを直してあげたよ!
deploy_docker_image:
runs-on: ubuntu-latest
env:
Expand All @@ -25,6 +46,7 @@ jobs:
contents: read
packages: write
if: github.event_name == 'release' || (github.event_name == 'pull_request' && github.event.action != 'closed' && github.repository == github.event.pull_request.head.repo.full_name)
needs: update-uv-version
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ghcr.io/astral-sh/uv:0.6.1-python3.13-bookworm-slim@sha256:1658218645a620230c3121cfabb3546adc5085408f6eb152dea615af5dc2710f AS base
FROM ghcr.io/astral-sh/uv:0.6.2-python3.13-bookworm-slim@sha256:25cfd9fb115d7c3b8a20b9df985a4c082abac1364f84ee94abe451b008e48625 AS base

# バージョン情報に表示する commit hash を埋め込む
FROM base AS commit-hash
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dependencies = [ "python-dotenv==1.0.1", "requests==2.32.3", "Pillow>=7.1.2", "o
dev = [ "autopep8==2.3.2", "requests-mock==1.12.1", "pylint==3.3.4", "sqlfluff==3.3.1", "mypy==1.15.0", "flake8==7.1.2", "isort==6.0.0", "pre-commit==4.1.0", "importlib-metadata==8.6.1", "toml==0.10.2", "types-toml==0.10.8.20240310", "pyink==24.10.0",]

[tool.uv]
required-version = "0.6.1"
required-version = "0.6.2"
[[tool.uv.index]]
name = "pypi"
url = "https://pypi.org/simple"
Expand Down
4 changes: 4 additions & 0 deletions scripts/deploy_hato_bot/update_uv_version/get_uv_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash

uv_version=$(grep ghcr.io/astral-sh/uv: Dockerfile | sed -e 's!FROM ghcr.io/astral-sh/uv:\([0-9.]*\)-.*!\1!g')
sed -i -e "s/required-version = .*/required-version = \"$uv_version\"/g" pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,3 @@ DOCKER_CMD="python --version 2>&1 | sed -e 's/^Python //g'"
python_version=$(docker compose run hato-bot sh -c "${DOCKER_CMD}")
echo "Python version:" "${python_version}"
sed -i -e "s/requires-python = \"==.*\"/requires-python = \"==${python_version}\"/g" pyproject.toml
DOCKER_CMD="uv version | sed -e 's/uv \([0-9.]*\)/\1/g'"
uv_version=$(docker compose run hato-bot sh -c "${DOCKER_CMD}")
sed -i -e "s/required-version = .*/required-version = \"$uv_version\"/g" pyproject.toml

0 comments on commit e83e673

Please sign in to comment.