Skip to content

Commit 0b9c98c

Browse files
authored
feat: move semantic to action (#9)
* feat: move semantic to action * feat: move semantic to action * feat: move semantic to action * feat: move semantic to action * feat: move semantic to action
1 parent 9cc5795 commit 0b9c98c

File tree

3 files changed

+67
-60
lines changed

3 files changed

+67
-60
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: "Test job"
2+
description: "Reusable action to perform a task"
3+
inputs:
4+
github-token:
5+
description: "GitHub token for the semantic release action"
6+
required: true
7+
release-assets:
8+
required: false
9+
type: string
10+
default: ''
11+
tag-prefix:
12+
description: "Tag prefix for the release"
13+
required: false
14+
type: string
15+
default: 'v'
16+
runs:
17+
using: "composite"
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
21+
22+
- name: Semantic Release
23+
id: semantic
24+
uses: cycjimmy/semantic-release-action@8e58d20d0f6c8773181f43eb74d6a05e3099571d # v3.4.2
25+
with:
26+
extra_plugins: |
27+
@semantic-release/changelog
28+
@semantic-release/git
29+
branches: |
30+
[
31+
'master',
32+
'main'
33+
]
34+
tag_format: ${{ inputs.tag-prefix }}${version}
35+
env:
36+
GITHUB_TOKEN: ${{ inputs.github-token }}
37+
38+
- name: Semantic Release - Output
39+
shell: bash
40+
run: |
41+
echo "### Semantic Release published: ${{ steps.semantic.outputs.new_release_published }}" >> $GITHUB_STEP_SUMMARY
42+
echo "### Semantic Release version: ${{ steps.semantic.outputs.new_release_version }}" >> $GITHUB_STEP_SUMMARY
43+
44+
- name: Upload Additional Assets
45+
if: inputs.release-assets != '' && steps.semantic.outputs.new_release_published == 'true'
46+
uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda # v2.2.1
47+
with:
48+
tag_name: ${{ inputs.tag-prefix }}${{ steps.semantic.outputs.new_release_version }}
49+
files: ${{ inputs.release-assets }}

.github/workflows/pr-semantic.yaml

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,21 @@ on:
99

1010
jobs:
1111
semantic-release:
12-
uses: ./.github/workflows/reusable-semantic.yaml
13-
with:
14-
environment: dev
15-
release-assets: |
16-
gradle/wrapper/gradle-wrapper.properties
17-
build.gradle
18-
tag-prefix: 'test-v'
12+
runs-on: ubuntu-22.04
13+
environment: ${{ inputs.environment }}
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
18+
- name: Create
19+
run: echo "TEST" >> test.txt
20+
21+
- name: Create
22+
uses: ./.github/actions/semantic
23+
with:
24+
github-token: ${{ secrets.GITHUB_TOKEN }}
25+
release-assets: |
26+
gradle/wrapper/gradle-wrapper.properties
27+
build.gradle
28+
text.txt
29+
tag-prefix: 'test-v'

.github/workflows/reusable-semantic.yaml

Lines changed: 0 additions & 53 deletions
This file was deleted.

0 commit comments

Comments
 (0)