Skip to content

Commit 52ab2f6

Browse files
✨ Update release workflow
1 parent 5c760fd commit 52ab2f6

File tree

8 files changed

+191
-75
lines changed

8 files changed

+191
-75
lines changed

.github/workflows/pull-request.yml renamed to .github/workflows/auto-create-pull-request.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Pull Request
1+
name: (Auto) Create Pull Request
22

33
on:
44
push:
@@ -31,7 +31,7 @@ jobs:
3131
run: task lint
3232

3333
build-and-push:
34-
name: Build and Push test
34+
name: Build and push
3535
runs-on: ubuntu-24.04-arm
3636
needs: [lint]
3737
steps:
@@ -85,11 +85,10 @@ jobs:
8585
version: 3.x
8686

8787
- name: Get template
88-
shell: bash
8988
run: task git:get-pr-template
9089

9190
- name: Create Pull Request
92-
uses: devops-infra/action-pull-request@v0.6
91+
uses: devops-infra/action-pull-request@v1
9392
with:
9493
github_token: ${{ secrets.GITHUB_TOKEN }}
9594
assignee: ${{ github.actor }}
Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
1-
name: Manual Release
1+
name: (Auto) Create release
22

33
on:
4-
workflow_dispatch:
5-
inputs:
6-
version:
7-
description: Release version (e.g., v1.2.3)
8-
required: true
9-
type: string
10-
default: __TAKEN_FROM_ACTION_YML__
4+
pull_request:
5+
types: [closed]
6+
push:
7+
branches:
8+
- release/**
119

1210
permissions:
1311
contents: write
1412
packages: write
1513

1614
jobs:
1715
release:
16+
if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/')
1817
name: Create Release
1918
runs-on: ubuntu-24.04-arm
2019
steps:
@@ -32,9 +31,9 @@ jobs:
3231
- name: Create and push git tags
3332
id: version
3433
env:
35-
VERSION_OVERRIDE: ${{ github.event.inputs.version }}
3634
VERSION_SUFFIX: ""
3735
run: |
36+
task lint
3837
task git:set-config
3938
task version:tag-release
4039
echo "REL_VERSION=$(task version:get)" >> "$GITHUB_OUTPUT"
@@ -52,25 +51,22 @@ jobs:
5251

5352
- name: Get Docker commands
5453
env:
55-
VERSION_OVERRIDE: ${{ github.event.inputs.version }}
5654
VERSION_SUFFIX: ""
5755
run: task docker:cmds
5856

59-
- name: Build and push Docker images
57+
- name: Build and Push
6058
env:
6159
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
6260
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63-
VERSION_OVERRIDE: ${{ github.event.inputs.version }}
6461
VERSION_SUFFIX: ""
6562
run: task docker:push
6663

6764
- name: Inspect image
6865
env:
69-
VERSION_OVERRIDE: ${{ github.event.inputs.version }}
7066
VERSION_SUFFIX: ""
7167
run: task docker:push:inspect
7268

73-
- name: Create GitHub Release
69+
- name: Create GitHub release
7470
uses: softprops/action-gh-release@v2
7571
with:
7672
tag_name: ${{ steps.version.outputs.REL_VERSION }}
@@ -81,7 +77,7 @@ jobs:
8177
env:
8278
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8379

84-
- name: Update Docker Hub description
80+
- name: Update Docker hub description
8581
uses: peter-evans/dockerhub-description@v5
8682
with:
8783
username: ${{ vars.DOCKER_USERNAME }}

.github/workflows/weekly-dependency-check.yml renamed to .github/workflows/cron-check-dependencies.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Weekly Dependency Check
1+
name: (Cron) Check dependencies
22

33
on:
44
schedule:
@@ -11,7 +11,7 @@ permissions:
1111

1212
jobs:
1313
dependency-check:
14-
name: Test Dependencies
14+
name: Test dependencies
1515
runs-on: ubuntu-24.04-arm
1616
steps:
1717
- name: Checkout
@@ -36,6 +36,9 @@ jobs:
3636
image: tonistiigi/binfmt:latest
3737
platforms: amd64,arm64
3838

39+
- name: Run linters
40+
run: task lint
41+
3942
- name: Get Docker commands
4043
run: task docker:cmds
4144

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
name: (Manual) Update Version
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
type:
7+
description: Bump type
8+
required: true
9+
default: patch
10+
type: choice
11+
options:
12+
- patch
13+
- minor
14+
- major
15+
- set
16+
version:
17+
description: Explicit version when type="set" (e.g., v1.2.3)
18+
required: false
19+
default: ''
20+
21+
permissions:
22+
contents: write
23+
pull-requests: write
24+
packages: write
25+
26+
jobs:
27+
update:
28+
name: Update version and push release branch
29+
runs-on: ubuntu-latest
30+
steps:
31+
- name: Checkout
32+
uses: actions/checkout@v5
33+
with:
34+
fetch-depth: 0
35+
fetch-tags: true
36+
37+
- name: Install Task
38+
uses: arduino/[email protected]
39+
with:
40+
version: 3.x
41+
42+
- name: Update version
43+
id: version
44+
env:
45+
BUMP_TYPE: ${{ github.event.inputs.type }}
46+
INPUT_VERSION: ${{ github.event.inputs.version }}
47+
run: |
48+
set -eux
49+
case "${BUMP_TYPE}" in
50+
set)
51+
if [ -z "${INPUT_VERSION}" ]; then
52+
echo "Missing version for type=set"
53+
exit 1
54+
fi
55+
task version:set VERSION_OVERRIDE="${INPUT_VERSION}"
56+
;;
57+
patch)
58+
task version:update:patch
59+
;;
60+
minor)
61+
task version:update:minor
62+
;;
63+
major)
64+
task version:update:major
65+
;;
66+
*)
67+
echo "Unknown type: ${BUMP_TYPE}"
68+
exit 1
69+
;;
70+
esac
71+
echo "REL_VERSION=$(task version:get)" >> "$GITHUB_OUTPUT"
72+
73+
- name: Install Docker Buildx
74+
uses: docker/setup-buildx-action@v3
75+
with:
76+
install: true
77+
78+
- name: Install QEMU
79+
uses: docker/setup-qemu-action@v3
80+
with:
81+
image: tonistiigi/binfmt:latest
82+
platforms: amd64,arm64
83+
84+
- name: Get Docker commands
85+
run: task docker:cmds
86+
87+
- name: Build and push test image
88+
env:
89+
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
90+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
91+
run: task docker:push
92+
93+
- name: Inspect image
94+
run: task docker:push:inspect
95+
96+
- name: Get template
97+
env:
98+
VERSION_SUFFIX: ""
99+
run: |
100+
task git:set-config
101+
task git:get-pr-template
102+
103+
- name: Push to release branch
104+
uses: devops-infra/action-commit-push@v1
105+
with:
106+
github_token: ${{ secrets.GITHUB_TOKEN }}
107+
commit_message: ":rocket: Bump version to ${{ steps.version.outputs.REL_VERSION }}"
108+
target_branch: ${{ format('release/{0}', steps.version.outputs.REL_VERSION) }}
109+
110+
- name: Create Pull Request
111+
uses: devops-infra/action-pull-request@v1
112+
with:
113+
github_token: ${{ secrets.GITHUB_TOKEN }}
114+
assignee: ${{ github.actor }}
115+
template: .tmp/PULL_REQUEST_TEMPLATE.md
116+
get_diff: true

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2021 Krzysztof Szyper aka ChristophShyper (https://shyper.pro/)
3+
Copyright (c) 2020 Krzysztof Szyper aka ChristophShyper (https://shyper.pro/)
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
11
# 🚀 GitHub Action for creating Pull Requests
2-
32
**GitHub Action that will create a pull request from the currently selected branch.**
43

5-
**Useful in combination with my other action [devops-infra/action-commit-push](https://github.com/devops-infra/action-commit-push).**
6-
74

85
## 📦 Available on
9-
106
- **Docker Hub:** [devopsinfra/action-pull-request:latest](https://hub.docker.com/repository/docker/devopsinfra/action-pull-request)
117
- **GitHub Packages:** [ghcr.io/devops-infra/action-pull-request:latest](https://github.com/devops-infra/action-pull-request/pkgs/container/action-pull-request)
128

139

1410
## ✨ Features
15-
1611
* Creates pull request if triggered from a current branch or any specified by `source_branch` to a `target_branch`
1712
* Title and body of a pull request can be specified with `title` and `body`
1813
* Can assign `assignee`, `reviewer`, one or more `label`, a `milestone` or mark it as a `draft`
@@ -22,8 +17,11 @@
2217
* Supports both `amd64` and `arm64` architectures
2318

2419

25-
## 📊 Badges
20+
## 🔗 Related Actions
21+
**Useful in combination with my other action [devops-infra/action-commit-push](https://github.com/devops-infra/action-commit-push).**
22+
2623

24+
## 📊 Badges
2725
[
2826
![GitHub repo](https://img.shields.io/badge/GitHub-devops--infra%2Faction--pull--request-blueviolet.svg?style=plastic&logo=github)
2927
![GitHub last commit](https://img.shields.io/github/last-commit/devops-infra/action-pull-request?color=blueviolet&logo=github&style=plastic&label=Last%20commit)
@@ -39,8 +37,14 @@
3937
](https://hub.docker.com/r/devopsinfra/action-pull-request "shields.io")
4038

4139

42-
## 📖 API Reference
40+
## 🏷️ Version Tags: vX, vX.Y, vX.Y.Z
41+
This action supports three tag levels for flexible versioning:
42+
- `vX`: latest patch of the major version (e.g., `v1`).
43+
- `vX.Y`: latest patch of the minor version (e.g., `v1.2`).
44+
- `vX.Y.Z`: fixed to a specific release (e.g., `v1.2.3`).
45+
4346

47+
## 📖 API Reference
4448
```yaml
4549
- name: Run the Action
4650
uses: devops-infra/[email protected]
@@ -65,7 +69,6 @@
6569
6670
6771
### 🔧 Input Parameters
68-
6972
| Input Variable | Required | Default | Description |
7073
|-----------------|----------|-------------------------------|-------------------------------------------------------------------------------------------------------------------------|
7174
| `github_token` | **Yes** | `""` | GitHub token `${{ secrets.GITHUB_TOKEN }}` |
@@ -87,15 +90,13 @@
8790

8891

8992
### 📤 Outputs Parameters
90-
9193
| Output | Description |
9294
|-------------|-------------------------------|
9395
| `url` | Pull request URL |
9496
| `pr_number` | Number of GitHub pull request |
9597

9698

9799
### ➿ How get_diff works
98-
99100
In previous versions occurrences of following strings in a template result with replacing them with list of commits and list of modified files (`<!-- Diff commits -->` and `<!-- Diff files -->`).
100101

101102
Now this action will expect to have three types of comment blocks. Meaning anything between `START` and `END` comment will get replaced. This is especially important when updating pull request with new commits.
@@ -118,7 +119,6 @@ Blue areas show fields that can be set in action configuration.
118119

119120

120121
### 📝 Basic Example
121-
122122
Create pull request for non-master branches:
123123

124124
```yaml
@@ -141,7 +141,6 @@ jobs:
141141
```
142142

143143
### 🔀 Advanced Example
144-
145144
Use first commit as a title and part of body, add a label based on a branch name, add git differences in the template:
146145

147146
```yaml
@@ -173,7 +172,6 @@ jobs:
173172
```
174173

175174
### 🎯 Use specific version
176-
177175
Run the Action with a specific version tag.
178176

179177
```yaml
@@ -198,24 +196,16 @@ jobs:
198196
```
199197

200198

201-
## 🔗 Related Actions
202-
203-
- [devops-infra/action-commit-push](https://github.com/devops-infra/action-commit-push) - Commit and push changes to a git repository
204-
205-
206199
## 🤝 Contributing
207-
208200
Contributions are welcome! See [CONTRIBUTING](https://github.com/devops-infra/.github/blob/master/CONTRIBUTING.md).
209201
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
210202

211203

212204
## 📄 License
213-
214205
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
215206

216207

217208
## 💬 Support
218-
219209
If you have any questions or need help, please:
220210
- 📝 Create an [issue](https://github.com/devops-infra/action-pull-request/issues)
221211
- 🌟 Star this repository if you find it useful!

0 commit comments

Comments
 (0)