Skip to content

Commit

Permalink
fix: Fix version increment @ new release (#39)
Browse files Browse the repository at this point in the history
fix version increment @ new release
  • Loading branch information
lorenzo-catalano authored Mar 29, 2024
1 parent c3a7ce0 commit 5db4c91
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 4 deletions.
45 changes: 45 additions & 0 deletions sbt-release/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Release

This action updates the version of the project using the semantic version and makes a release on GitHub.

Note: The project must have [this structure](https://github.com/pagopa/template-java-spring-microservice).

The action:

- calls the `sbt-semver` template to update the version of the project
- pushes to GitHub
- make a new Tag and Release on GitHub

The new version is saved in the output.

## Usage

``` yaml
- name: Make Release
id: release
uses: pagopa/github-actions-template/sbt-release@v1
with:
semver: 'major'
github_token: ${{ secrets.GITHUB_TOKEN }}
skip_ci: true
beta: false
jdk_version: 11

- run: echo "${{ steps.release.outputs.version }}"
```
## Input
| Param | Description | Required | Values | Default |
|--------------|-----------------------------------------------------------|----------|--------------------------------------------------|---------|
| semver | Select the new Semantic Version | **true** | `major`, `minor`, `patch`, `buildNumber`, `skip` | |
| github_token | A GitHub token | **true** | `string` | |
| beta | True if it is a beta version (update canary helm version) | false | `boolean` | false |
| skip_ci | True if you want skip CI workflows on commit release | false | `boolean` | true |
| jdk_version | Select the JDK version | false | `11`, `17` | `11` |

## Output

| Value | Description |
|---------|-------------|
| version | New Version |
44 changes: 44 additions & 0 deletions sbt-semver/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Maven Semantic Version

This action updates the version of the project using the semantic version passed in input.

Note: The project must have [this structure](https://github.com/pagopa/template-java-spring-microservice).

The action updates:

- the pom version (`/pom.xml`)
- the helm chart versions (`/helm/values-*.yaml`)
- the openapi/swagger version (`/openapi/openapi.json` json or yaml)

The new version is saved in the output.

## Usage

``` yaml
- name: Update Semantic Version
id: semver
uses: pagopa/github-actions-template/sbt-semver@v1
with:
semver: 'major'
beta: false
jdk_version: 11

- run: echo "${{ steps.semver.outputs.version }}"

- run: echo "${{ steps.semver.outputs.chart_version }}"
```
## Input
| Param | Description | Required | Values | Default |
|-------------|-----------------------------------------------------------|----------|--------------------------------------------------|---------|
| semver | Select the new Semantic Version | **true** | `major`, `minor`, `patch`, `buildNumber`, `skip` | |
| beta | True if it is a beta version (update canary helm version) | **true** | `boolean` | false |
| jdk_version | Select the JDK version | false | `11`, `17` | `11` |

## Output

| Value | Description |
|---------------|-------------------|
| version | New App Version |
| chart_version | New Chart Version |
8 changes: 4 additions & 4 deletions sbt-semver/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ inputs:
required: false
type: choice
description: Select the JDK version
default: 11
default: 17
options:
- 11
- 17
Expand Down Expand Up @@ -97,19 +97,19 @@ runs:

- name: Set major
run: |
echo "ThisBuild / version := \"$((${{env.MAJOR}})+1).0.0${{env.BRANCH}}\"" > version.sbt
echo "ThisBuild / version := \"$((${{env.MAJOR}}+1)).0.0${{env.BRANCH}}\"" > version.sbt
if: ${{ inputs.semver == 'major' }}
shell: bash

- name: Set minor
run: |
echo "ThisBuild / version := \"${{env.MAJOR}}.$((${{env.MINOR}})+1).0${{env.BRANCH}}\"" > version.sbt
echo "ThisBuild / version := \"${{env.MAJOR}}.$((${{env.MINOR}}+1)).0${{env.BRANCH}}\"" > version.sbt
if: ${{ inputs.semver == 'minor' }}
shell: bash

- name: Set patch
run: |
echo "ThisBuild / version := \"${{env.MAJOR}}.${{env.MINOR}}.$((${{env.PATCH}})+1)${{env.BRANCH}}\"" > version.sbt
echo "ThisBuild / version := \"${{env.MAJOR}}.${{env.MINOR}}.$((${{env.PATCH}}+1))${{env.BRANCH}}\"" > version.sbt
if: ${{ inputs.semver == 'patch' }}
shell: bash

Expand Down

0 comments on commit 5db4c91

Please sign in to comment.