Skip to content

feat: move semantic to action #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/actions/semantic/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: "Test job"
description: "Reusable action to perform a task"
inputs:
github-token:
description: "GitHub token for the semantic release action"
required: true
release-assets:
required: false
type: string
default: ''
tag-prefix:
description: "Tag prefix for the release"
required: false
type: string
default: 'v'
runs:
using: "composite"
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3

- name: Semantic Release
id: semantic
uses: cycjimmy/semantic-release-action@8e58d20d0f6c8773181f43eb74d6a05e3099571d # v3.4.2
with:
extra_plugins: |
@semantic-release/changelog
@semantic-release/git
branches: |
[
'master',
'main'
]
tag_format: ${{ inputs.tag-prefix }}${version}
env:
GITHUB_TOKEN: ${{ inputs.github-token }}

- name: Semantic Release - Output
shell: bash
run: |
echo "### Semantic Release published: ${{ steps.semantic.outputs.new_release_published }}" >> $GITHUB_STEP_SUMMARY
echo "### Semantic Release version: ${{ steps.semantic.outputs.new_release_version }}" >> $GITHUB_STEP_SUMMARY

- name: Upload Additional Assets
if: inputs.release-assets != '' && steps.semantic.outputs.new_release_published == 'true'
uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda # v2.2.1
with:
tag_name: ${{ inputs.tag-prefix }}${{ steps.semantic.outputs.new_release_version }}
files: ${{ inputs.release-assets }}
25 changes: 18 additions & 7 deletions .github/workflows/pr-semantic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,21 @@ on:

jobs:
semantic-release:
uses: ./.github/workflows/reusable-semantic.yaml
with:
environment: dev
release-assets: |
gradle/wrapper/gradle-wrapper.properties
build.gradle
tag-prefix: 'test-v'
runs-on: ubuntu-22.04
environment: ${{ inputs.environment }}
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Create
run: echo "TEST" >> test.txt

- name: Create
uses: ./.github/actions/semantic
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
release-assets: |
gradle/wrapper/gradle-wrapper.properties
build.gradle
text.txt
tag-prefix: 'test-v'
53 changes: 0 additions & 53 deletions .github/workflows/reusable-semantic.yaml

This file was deleted.

Loading