Skip to content

chore(deps): update astral-sh/setup-uv action to v10.1.0 #3966

chore(deps): update astral-sh/setup-uv action to v10.1.0

chore(deps): update astral-sh/setup-uv action to v10.1.0 #3966

Workflow file for this run

name: CI
on:
# schedule:
# - cron: "34 10 * * *"
push:
branches: ["master", "renovate/*"]
tags: ["*"]
pull_request:
branches: ["master"]
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: japan7/nanachan
MAIN_BRANCH: master
jobs:
check:
if: startsWith(github.ref, 'refs/tags/') != true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: astral-sh/setup-uv@v10.1.0
- run: cp nanachan/example.local_settings.py nanachan/local_settings.py
- run: HOOKS_KEEP_GOING=1 HOOKS_PYRIGHT_CHECK=1 hooks/pre-commit
- uses: sarisia/actions-status-discord@v1
if: failure()
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
# https://docs.docker.com/build/ci/github-actions/multi-platform/#distribute-build-across-multiple-runners
build:
strategy:
fail-fast: false
matrix:
include:
- platform: linux/amd64
runner: ubuntu-24.04
- platform: linux/arm64
runner: ubuntu-24.04-arm
runs-on: ${{ matrix.runner }}
steps:
- name: Checkout repository
uses: actions/checkout@v7
- name: Prepare
run: |
platform=${{ matrix.platform }}
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
- name: Docker meta
id: meta
uses: docker/metadata-action@v6
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Login to ${{ env.REGISTRY }}
if: (github.event_name != 'pull_request') && !startsWith(github.ref, 'refs/heads/renovate')
uses: docker/login-action@v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Build and push by digest
id: build
uses: docker/build-push-action@v7
with:
context: .
platforms: ${{ matrix.platform }}
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
outputs: type=image,push-by-digest=true,name-canonical=true,push=${{ (github.event_name != 'pull_request') && !startsWith(github.ref, 'refs/heads/renovate') }}
cache-from: type=gha,scope=buildkit-${{ env.PLATFORM_PAIR }}
cache-to: type=gha,mode=max,scope=buildkit-${{ env.PLATFORM_PAIR }}
- name: Export digest
run: |
mkdir -p ${{ runner.temp }}/digests
digest="${{ steps.build.outputs.digest }}"
touch "${{ runner.temp }}/digests/${digest#sha256:}"
- name: Upload digest
uses: actions/upload-artifact@v7
with:
name: digests-${{ env.PLATFORM_PAIR }}
path: ${{ runner.temp }}/digests/*
if-no-files-found: error
retention-days: 1
- uses: sarisia/actions-status-discord@v1
if: failure()
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
merge:
if: (github.event_name != 'pull_request') && !startsWith(github.ref, 'refs/heads/renovate')
needs: build
runs-on: ubuntu-latest
steps:
- name: Download digests
uses: actions/download-artifact@v8
with:
path: ${{ runner.temp }}/digests
pattern: digests-*
merge-multiple: true
- name: Login to ${{ env.REGISTRY }}
uses: docker/login-action@v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Docker meta
id: meta
uses: docker/metadata-action@v6
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=schedule
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
type=sha
- name: Create manifest list and push
working-directory: ${{ runner.temp }}/digests
run: |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@sha256:%s ' *)
- name: Inspect image
run: |
docker buildx imagetools inspect ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version }}
- uses: sarisia/actions-status-discord@v1
if: failure()
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
deploy:
needs: merge
runs-on: ubuntu-latest
permissions:
contents: write
actions: write
steps:
- name: Checkout nanak8s
uses: actions/checkout@v7
with:
repository: Japan7/nanak8s
token: ${{ secrets.NANAK8S_PAT }}
- name: Set deploy environment
id: deploy_env
run: |
if [[ "$GITHUB_REF" == "refs/tags/"* ]]; then
echo "::set-output name=name::nana"
echo "::set-output name=tag::${GITHUB_REF#refs/tags/}"
elif [[ "$GITHUB_REF" == "refs/heads/${MAIN_BRANCH}" ]]; then
echo "::set-output name=name::hachi"
echo "::set-output name=tag::sha-${GITHUB_SHA::7}"
else
echo "::set-output name=name::snow"
echo "::set-output name=tag::sha-${GITHUB_SHA::7}"
fi
- name: Update nanak8s
run: |
yq e -i '(.environments.${{ steps.deploy_env.outputs.name }}.values[] | select(has("tag"))).tag = "${{ steps.deploy_env.outputs.tag }}"' apps/nanachan/environments.yaml
git add apps/nanachan/environments.yaml
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
git commit -m "[CI] Update nanachan-${{ steps.deploy_env.outputs.name }} to ${{ steps.deploy_env.outputs.tag }}" -m "https://github.com/$GITHUB_REPOSITORY/commit/$GITHUB_SHA"
git push
- uses: sarisia/actions-status-discord@v1
if: failure()
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}