forked from NationalSecurityAgency/emissary
-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (57 loc) · 2.25 KB
/
maven-version.yml
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
# Action to manually set the next development version
---
name: "Maven: Set Next Development Version"
on: # yamllint disable-line rule:truthy
workflow_dispatch:
inputs:
next_version:
description: "Set the next development version"
required: true
default: ""
env:
JAVA_VERSION: "11"
JAVA_DISTRIBUTION: "corretto"
MAVEN_OPTS: "-Dhttps.protocols=TLSv1.2 -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Djava.awt.headless=true"
jobs:
verify:
runs-on: ubuntu-latest
steps:
- name: Check release ends with snapshot
if: ${{ !endsWith(github.event.inputs.next_version, '-SNAPSHOT') }}
run: |
echo "Invalid input: next development version ${{ github.event.inputs.next_version }} does not end with '-SNAPSHOT'"
exit 1
snapshot-bump:
needs: verify
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: ${{ env.JAVA_DISTRIBUTION }}
cache: "maven"
- name: Configure Git user
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
- name: Set the name of the branch
run: echo "PR_BRANCH=action/${{ github.event.inputs.next_version }}" >> "$GITHUB_ENV"
- name: Create a branch
run: git switch -c ${{ env.PR_BRANCH }}
- name: Set the next snapshot version
run: |
mvn -B -V -e -ntp versions:set -DnewVersion=${{ github.event.inputs.next_version }} -DgenerateBackupPoms=false
mvn -B -V -e -ntp versions:commit
git add .
git commit -m "[github-actions](${{ github.actor }}) next development iteration"
git push -u origin ${{ env.PR_BRANCH }}
- name: Create pull request
run: gh pr create -B main -H ${{ env.PR_BRANCH }} --title 'next development iteration ${{ github.event.inputs.next_version }}' --body 'Created by GitHub Action'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}