Repository navigation
111 lines (93 loc) · 3.44 KB
/
Copy pathrelease.yml
File metadata and controls
111 lines (93 loc) · 3.44 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
name: Release
on:
push:
branches:
- main
release:
types:
- released
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'push' }}
permissions:
contents: write
packages: write
pull-requests: read
env:
REGISTRY: ghcr.io
jobs:
publish:
runs-on: ubuntu-latest
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: Setup Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Log in to Container Registry
uses: docker/login-action@v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Metadata
id: meta
uses: docker/metadata-action@v6
with:
images: ${{ env.REGISTRY }}/${{ github.repository }}/${{ matrix.image }}
tags: |
type=ref,event=branch
type=raw,value=latest
type=sha,enable=${{ github.event_name == 'push' }}
type=raw,value=${{ github.event.release.tag_name }},enable=${{ github.event_name == 'release' }}
labels: &details |
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 }}
annotations: *details
env:
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest
- 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 }}
annotations: ${{ steps.meta.outputs.annotations }}
cache-from: type=gha,scope=${{ matrix.image }}
cache-to: type=gha,mode=max,scope=${{ matrix.image }}
draft:
needs: publish
if: github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Update Draft Release
uses: release-drafter/release-drafter@v7.11.0
with:
config-name: release-drafter.yml
commitish: ${{ github.sha }}
publish: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}