Skip to content

Commit 5f9253f

Browse files
committed
Updated workflow
1 parent d1bd3db commit 5f9253f

1 file changed

Lines changed: 37 additions & 27 deletions

File tree

.github/workflows/release.yml

Lines changed: 37 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,51 @@
1-
name: GitHub Actions Demo
1+
name: Release
22
run-name: New Release Workflow
33
on:
44
workflow_dispatch:
55
inputs:
66
version:
7-
description: 'Version number for the new release'
7+
description: "Version (for example 1.2.3)"
88
required: true
9-
default: '2.0.0'
10-
commit_hash:
11-
description: 'Commit hash for the release'
12-
required: true
13-
default: ''
14-
message:
15-
description: 'Release message'
16-
required: true
17-
default: ''
9+
type: string
1810
jobs:
19-
run-test:
11+
validate-input:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Validate version
16+
shell: bash
17+
run: |
18+
VERSION="${{ inputs.version }}"
19+
20+
if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$ ]]; then
21+
echo "Invalid version: $VERSION"
22+
exit 1
23+
fi
24+
25+
echo "Version is valid: $VERSION"
26+
27+
28+
build:
2029
runs-on: ubuntu-latest
30+
needs: validate-input
31+
2132
steps:
22-
- name: Checkout code
33+
- name: Checkout main
2334
uses: actions/checkout@v4
2435
with:
25-
ref: ${{ github.event.inputs.commit_hash || github.sha }}
26-
27-
- name: Run Tests
28-
run: mvn test
36+
ref: main
2937

38+
- name: Setup Java
39+
uses: actions/setup-java@v5
40+
with:
41+
distribution: temurin
42+
java-version: 21
43+
cache: maven
3044

31-
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
32-
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
33-
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
34-
- name: Check out repository code
35-
uses: actions/checkout@v4
36-
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
37-
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
38-
- name: List files in the repository
45+
- name: Show build info
3946
run: |
40-
ls ${{ github.workspace }}
41-
- run: echo "🍏 This job's status is ${{ job.status }}."
47+
echo "Building version ${{ inputs.version }}"
48+
git log -1 --oneline
49+
50+
- name: Build Maven project
51+
run: mvn -B clean verify

0 commit comments

Comments
 (0)