-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (96 loc) · 3.11 KB
/
release.yaml
File metadata and controls
97 lines (96 loc) · 3.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: UV - Release (Reusable)
on:
workflow_call:
inputs:
DOCKER_USERNAME:
required: true
type: string
DOCKER_REPOSITORY:
required: true
type: string
UV_VERSION:
required: false
type: string
default: '>=0.10.10'
PYTHON_VERSION:
required: false
type: string
default: '3.13'
DOCKER_PATH_CONTEXT:
required: true
type: string
DOCKER_BUILD_DOCKERFILE:
required: true
type: string
jobs:
Semantic-Release:
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.release.outputs.tag }}
concurrency:
group: ${{ github.workflow }}-release-${{ github.ref_name }}
cancel-in-progress: false
permissions:
contents: write
env:
dist_artifacts_name: dist
dist_artifacts_dir: dist
lock_file_artifact: uv.lock
UV_VERSION: ${{ inputs.UV_VERSION }}
PYTHON_VERSION: ${{ inputs.PYTHON_VERSION }}
GITHUB_ACTIONS_AUTHOR_NAME: github-actions
GITHUB_ACTIONS_AUTHOR_EMAIL: actions@users.noreply.github.com
steps:
- name: Setup | Checkout Repository on Release Branch
uses: actions/checkout@v6
with:
ref: ${{ github.ref_name }}
- name: Setup | Force release branch to be at workflow sha
run: |
git reset --hard ${{ github.sha }}
- name: Restore global uv cache
id: cache-restore
uses: actions/cache/restore@v5
with:
path: |
~/.cache/uv
~/.local/share/uv
.venv
key: uv-main-${{ env.UV_VERSION }}-${{ env.PYTHON_VERSION }}-${{ hashFiles('pyproject.toml', 'uv.lock') }}
restore-keys: |
uv-main-
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
version: ${{ env.UV_VERSION }}
python-version: ${{ env.PYTHON_VERSION }}
enable-cache: false
- name: Action | Semantic Version Release
id: release
uses: python-semantic-release/python-semantic-release@v10.5.3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Action | Create GitHub Release
uses: python-semantic-release/publish-action@v10.5.3
if: steps.release.outputs.released == 'true'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.release.outputs.tag }}
- name: Save uv caches
if: always()
uses: actions/cache/save@v5
with:
path: |
~/.cache/uv
~/.local/share/uv
.venv
key: uv-main-${{ env.UV_VERSION }}-${{ env.PYTHON_VERSION }}-${{ hashFiles('pyproject.toml', 'uv.lock') }}
Docker-Release:
uses: ./.github/workflows/docker-build-and-scan.yaml
needs: Semantic-Release
secrets: inherit
with:
DOCKER_PATH_CONTEXT: ${{ inputs.DOCKER_PATH_CONTEXT }}
DOCKER_BUILD_DOCKERFILE: ${{ inputs.DOCKER_BUILD_DOCKERFILE }}
DOCKER_TAGS: ${{ inputs.DOCKER_USERNAME }}/${{ inputs.DOCKER_REPOSITORY }}:${{ needs.Semantic-Release.outputs.tag }}
DOCKER_USERNAME: ${{ inputs.DOCKER_USERNAME }}