Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,3 @@ hotfix:

refactor:
- head-branch: ["^refactor/"]

release:
- head-branch: ["^release/"]
15 changes: 0 additions & 15 deletions .github/protection.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,4 @@
{
"develop": {
"allow_deletions": false,
"allow_force_pushes": false,
"enforce_admins": false,
"required_pull_request_reviews": {
"dismiss_stale_reviews": false,
"require_code_owner_reviews": false,
"required_approving_review_count": 1
},
"required_status_checks": {
"contexts": [],
"strict": true
},
"restrictions": null
},
"main": {
"allow_deletions": false,
"allow_force_pushes": false,
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/approve.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
approve:
runs-on: ubuntu-latest

if: endsWith(github.actor, '[bot]')
if: github.event.pull_request.user.type == 'Bot'

steps:
- name: Checkout
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/assign.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
assign:
runs-on: ubuntu-latest

if: endsWith(github.actor, '[bot]') == false && github.event.pull_request.assignee == null
if: github.event.pull_request.user.type != 'Bot' && github.event.pull_request.assignee == null

steps:
- name: Add assignees
Expand Down
73 changes: 0 additions & 73 deletions .github/workflows/publish-app.yml

This file was deleted.

73 changes: 0 additions & 73 deletions .github/workflows/publish-devcontainer.yml

This file was deleted.

102 changes: 73 additions & 29 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,60 +3,104 @@ name: Release
on:
push:
branches:
- develop
- main
release:
types:
- released

concurrency:
group: release-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'push' }}

permissions:
contents: write
packages: write
pull-requests: read

jobs:
develop:
if: github.ref_name == 'develop'
env:
REGISTRY: ghcr.io

jobs:
publish:
runs-on: ubuntu-latest

environment: Develop
environment: ${{ github.event_name == 'release' && 'Production' || 'Develop' }}

strategy:
fail-fast: false
matrix:
include:
- image: app
dockerfile: Dockerfile
description: App for Python development with uv-based dependency management and environment configuration.
- image: devcontainer
dockerfile: .devcontainer/Dockerfile
description: Dev Container for Python development with uv-based dependency management and environment configuration.

steps:
- name: Checkout
uses: actions/checkout@v7

- name: Update Draft Release
uses: release-drafter/release-drafter@v7.10.0
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v4

- name: Log in to Container Registry
uses: docker/login-action@v4.6.0
with:
config-name: release-drafter.yml
publish: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

production:
if: github.ref_name == 'main'
- name: Extract Metadata
id: meta
uses: docker/metadata-action@v6
with:
images: ${{ env.REGISTRY }}/${{ github.repository }}/${{ matrix.image }}
tags: |
type=ref,event=branch
type=sha,format=long,enable=${{ github.event_name == 'push' }}
type=raw,value=${{ github.event.release.tag_name }},enable=${{ github.event_name == 'release' }}
type=raw,value=latest,enable=${{ github.event_name == 'release' }}
labels: |
maintainer=a5chin <a5chin.origin+contact@gmail.com>
org.opencontainers.image.authors=a5chin <a5chin.origin+contact@gmail.com>
org.opencontainers.image.description=${{ matrix.description }}
org.opencontainers.image.documentation=https://a5chin.github.io/python-uv/
org.opencontainers.image.licenses=MIT
org.opencontainers.image.source=https://github.com/${{ github.repository }}
org.opencontainers.image.title=python-uv
org.opencontainers.image.url=https://github.com/${{ github.repository }}
org.opencontainers.image.vendor=a5chin <a5chin.origin+contact@gmail.com>
org.opencontainers.image.version=${{ github.event.release.tag_name || github.ref_name }}

runs-on: ubuntu-latest
- name: Build and Push Image
uses: docker/build-push-action@v7
with:
context: .
file: ${{ matrix.dockerfile }}
push: true
provenance: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha,scope=${{ matrix.image }}
cache-to: type=gha,mode=max,scope=${{ matrix.image }}

environment: Production
draft:
needs: publish

if: github.event_name == 'push'

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v7

- name: Get PR Title for Version
id: pr
run: |
PR_TITLE=$(gh pr list --search "${{ github.sha }}" --state merged --json title --jq '.[0].title')
echo "TITLE=$PR_TITLE" >> "$GITHUB_OUTPUT"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Publish Release
- name: Update Draft Release
uses: release-drafter/release-drafter@v7.10.0
with:
config-name: release-drafter.yml
name: ${{ env.VERSION }}
publish: true
tag: ${{ env.VERSION }}
version: ${{ env.VERSION }}
commitish: ${{ github.sha }}
publish: false
env:
VERSION: ${{ steps.pr.outputs.TITLE }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18 changes: 11 additions & 7 deletions .github/workflows/setting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Enable auto-delete head branches
run: |
gh repo edit ${{ github.repository }} \
--default-branch develop \
--default-branch main \
--delete-branch-on-merge
env:
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
Expand All @@ -37,11 +37,14 @@ jobs:
matrix:
include:
- environment: Develop
branch: develop
pattern: main
type: branch
- environment: Production
branch: main
pattern: v*
type: tag
- environment: github-pages
branch: gh-pages
pattern: gh-pages
type: branch

steps:
- name: Checkout
Expand Down Expand Up @@ -74,11 +77,12 @@ jobs:
fi

gh api -X POST "${{ env.ENDPOINT }}/${{ env.ENVIRONMENT_NAME }}/deployment-branch-policies" \
-f "name=${{ env.BRANCH_NAME }}" \
-f "type=branch"
-f "name=${{ env.POLICY_PATTERN }}" \
-f "type=${{ env.POLICY_TYPE }}"
env:
CONFIG_FILE: .github/environments.json
BRANCH_NAME: ${{ matrix.branch }}
POLICY_PATTERN: ${{ matrix.pattern }}
POLICY_TYPE: ${{ matrix.type }}
ENDPOINT: repos/${{ github.repository }}/environments
ENVIRONMENT_NAME: ${{ matrix.environment }}
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ on:
- "uv.lock"
push:
branches:
- develop
- main
paths:
- ".github/actions/setup-python-with-uv/action.yml"
Expand Down
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ repos:
- id: check-yaml
name: Check YAML
description: Check that YAML files are valid
args: [--unsafe]

- id: detect-private-key
name: Detect private key
Expand Down
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
"path": "/bin/zsh"
}
},
"yaml.customTags": [
"tag:yaml.org,2002:python/name:pymdownx.superfences.fence_code_format"
],
"[dockercompose]": {
"editor.defaultFormatter": "redhat.vscode-yaml",
"editor.tabSize": 4
Expand Down
Loading
Loading