-
Notifications
You must be signed in to change notification settings - Fork 0
109 lines (91 loc) · 3.43 KB
/
release.yml
File metadata and controls
109 lines (91 loc) · 3.43 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
name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
packages: write
id-token: write # Required for provenance attestations
jobs:
build-and-release:
name: Build and Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract version from tag
id: version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Build and push Docker image
uses: docker/build-push-action@ca052bb54ab0790a636c9b5f226502c73d547a25 # v5
with:
context: .
push: true
provenance: true
sbom: true
tags: |
ghcr.io/${{ github.repository }}:${{ steps.version.outputs.VERSION }}
ghcr.io/${{ github.repository }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Create GitHub Release
uses: actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e # v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ steps.version.outputs.VERSION }}
body: |
## Create Pull Request Action (Python)
Release ${{ steps.version.outputs.VERSION }}
### Features
- Complete Python port of create-pull-request action
- All 23 inputs and 6 outputs supported
- Docker-based GitHub Action
- PyGithub for GitHub API interactions
- Comprehensive test coverage
### Usage
```yaml
- name: Create Pull Request
uses: ${{ github.repository }}@${{ steps.version.outputs.VERSION }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "Update files"
branch: feature-branch
title: "Automated PR"
```
### Docker Image
```
ghcr.io/${{ github.repository }}:${{ steps.version.outputs.VERSION }}
```
See [README.md](https://github.com/${{ github.repository }}/blob/${{ steps.version.outputs.VERSION }}/README.md) for full documentation.
draft: false
prerelease: false
update-major-tag:
name: Update Major Version Tag
runs-on: ubuntu-latest
needs: build-and-release
steps:
- name: Checkout code
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Extract major version
id: major
run: |
TAG=${GITHUB_REF#refs/tags/}
MAJOR=$(echo $TAG | cut -d. -f1)
echo "MAJOR=$MAJOR" >> $GITHUB_OUTPUT
- name: Update major version tag
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git tag -fa ${{ steps.major.outputs.MAJOR }} -m "Update ${{ steps.major.outputs.MAJOR }} tag"
git push origin ${{ steps.major.outputs.MAJOR }} --force