-
Notifications
You must be signed in to change notification settings - Fork 5
109 lines (95 loc) · 3.63 KB
/
Copy pathrelease.yaml
File metadata and controls
109 lines (95 loc) · 3.63 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
# yaml-language-server: $schema=https://www.schemastore.org/github-workflow.json
---
name: Release
on:
workflow_dispatch:
inputs:
version:
description: 'Custom version (optional, e.g., 1.2.3)'
required: false
type: string
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
jobs:
release:
if: github.repository_owner == 'guacsec'
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Set up Java
uses: actions/setup-java@v5
with:
java-version: '17'
distribution: 'temurin'
cache: 'maven'
- name: Set up Node.js
uses: actions/setup-node@v5
with:
node-version: 24
registry-url: 'https://registry.npmjs.org'
- name: Set release version
run: |
if [ -n "${{ github.event.inputs.version }}" ]; then
mvn -B versions:set -DnewVersion=${{ github.event.inputs.version }} -DgenerateBackupPoms=false
else
mvn -B versions:set -DremoveSnapshot -DgenerateBackupPoms=false
fi
mvn -B process-resources
mvn -B validate
- name: Get release version
id: version
run: |
V=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
echo "version=$V" >> $GITHUB_OUTPUT
- name: Create release branch
id: release_branch
run: |
BRANCH="release/v${{ steps.version.outputs.version }}"
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
git checkout -b "$BRANCH"
git add -A
git commit -m "build(release): release version ${{ steps.version.outputs.version }}"
echo "release_sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
# Force-push so we overwrite any existing release branch (e.g. from a previous run)
git push --force origin "$BRANCH"
echo "$BRANCH" > releasebranch.txt
- uses: actions/upload-artifact@v5
with:
name: releasebranch.txt
path: releasebranch.txt
- name: Create GitHub release tag
uses: softprops/action-gh-release@v1
with:
name: "Release ${{ steps.version.outputs.version }}"
tag_name: "v${{ steps.version.outputs.version }}"
target_commitish: ${{ steps.release_branch.outputs.release_sha }}
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Bump to next development version
run: |
mvn -B release:update-versions -DgenerateBackupPoms=false
mvn -B process-resources
git add -A
git commit -m "build(release): bump to next development version"
git push origin "release/v${{ steps.version.outputs.version }}"
- name: Create Pull Request for release + next version
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_BODY: |
This PR contains the following changes:
1. Release version bump to ${{ steps.version.outputs.version }}.
2. Filtered resources (docs, JS) updated to reflect the release version.
3. Next development version bump after the release.
run: |
gh pr create \
--title "build(release): release ${{ steps.version.outputs.version }} and bump to next development version" \
--body "$PR_BODY" \
--base main \
--head "release/v${{ steps.version.outputs.version }}"