Skip to content

Commit

Permalink
UID2-2674 Implement shared publish to docker versioned (#59)
Browse files Browse the repository at this point in the history
* Fix version_number_input for `Create Release`

* Fix Docker Release name

* Use kcc-UID2-2674-implement-shared-publish-to-docker-versioned for creating release

* use the alternative sort approach for retrieving the previous tag

* Use v4 version of mikepenz/release-changelog-builder-action

* Add v to the release name for the verion number

* Use `steps.setup.outputs.is_release` instead of `IS_RELEASE`

* Use v2 instead of kcc custom branch

* Remove `version_number_input` from inputs

* Change `version_number_input` to `new_version`

* Remove duplicated `new_version` inputs
  • Loading branch information
cYKatherine authored Feb 12, 2024
1 parent 68fe241 commit db70628
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 19 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/shared-increase-version-number.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ jobs:
echo "image_tag=${{ steps.version.outputs.new_version }}" >> $GITHUB_OUTPUT
- name: Commit ${{ inputs.working_dir }}/package.json and ${{ inputs.working_dir }}/version.json
if: ${{ inputs.version_number_input == '' && steps.checkRelease.outputs.IS_RELEASE != 'true' }}
if: ${{ inputs.version_number_input == '' && steps.setup.outputs.is_release != 'true' }}
uses: IABTechLab/uid2-shared-actions/actions/commit_pr_and_merge@main
with:
add: '${{ inputs.working_dir }}/package.json ${{ inputs.working_dir }}/version.json'
message: 'Released ${{ inputs.release_type }} version: ${{ steps.version.outputs.new_version }}'

- name: Commit ${{ inputs.working_dir }}/package.json, ${{ inputs.working_dir }}/version.json and set tag
if: ${{ inputs.version_number_input == '' && steps.checkRelease.outputs.IS_RELEASE == 'true' }}
if: ${{ inputs.version_number_input == '' && steps.setup.outputs.is_release == 'true' }}
uses: IABTechLab/uid2-shared-actions/actions/commit_pr_and_merge@main
with:
add: '${{ inputs.working_dir }}/package.json ${{ inputs.working_dir }}/version.json'
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/shared-publish-to-docker-versioned.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ on:
description: If true, will attempt to publish any vulnerabilities to GitHub. Defaults to true. Set to false for private repos.
type: string
default: true
version_number_input:
description: The version number to publish for the docker repo
type: string
default: ''
force_release:
description: If 'yes', will force the creation a release, if 'no' will not create a release. 'branch' will use release_type and the branch to determine if a release should be created.
type: string
Expand Down Expand Up @@ -77,7 +73,7 @@ jobs:
uses: IABTechLab/uid2-shared-actions/actions/shared_create_releases@v2
with:
is_release: ${{ steps.setup.outputs.is_release }}
version_number_input: ${{ inputs.version_number_input }}
new_version: ${{ inputs.new_version }}
tags: ${{ steps.publishToDocker.outputs.tags }}
image_tag: ${{ steps.updatePackageJson.outputs.image_tag }}
github_token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
21 changes: 9 additions & 12 deletions actions/shared_create_releases/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ inputs:
is_release:
description: True if a release should be created
default: false
version_number_input:
description: If set, the version number will not be incremented and the given number will be used.
default: ''
new_version:
description: The new version number to be incremented to
required: true
tags:
description: The docker image tags
default: ''
Expand All @@ -23,9 +23,6 @@ inputs:
repo:
description: The repo that publishing to.
default: ''
new_version:
description: The new version that are publish to Maven
default: ''

runs:
using: "composite"
Expand All @@ -34,9 +31,9 @@ runs:
- name: Build Docker Changelog
id: github_release_docker
if: ${{ inputs.is_release == 'true' && inputs.publish_platform == 'Docker'}}
uses: mikepenz/release-changelog-builder-action@v3
uses: mikepenz/release-changelog-builder-action@v4
with:
toTag: v${{ inputs.version_number_input }}
toTag: v${{ inputs.new_version }}
configurationJson: |
{
"template": "#{{CHANGELOG}}\n## Installation\n```\ndocker pull ${{ inputs.tags }}\n```\n\n## Image reference to deploy: \n```\n${{ inputs.image_tag }}\n```\n\n## Changelog\n#{{UNCATEGORIZED}}",
Expand All @@ -50,7 +47,7 @@ runs:
if: ${{ inputs.is_release == 'true' && inputs.publish_platform == 'Maven'}}
uses: mikepenz/release-changelog-builder-action@v3
with:
toTag: v${{ inputs.version_number_input }}
toTag: v${{ inputs.new_version }}
configurationJson: |
{
"template": "#{{CHANGELOG}}\n## Maven\n```\n<dependency>\n <groupId>com.uid2</groupId>\n <artifactId>${{ inputs.repo }}</artifactId>\n <version>${{ inputs.new_version }}</version>\n</dependency>\n```\n\n## Jar Files\n- [${{ inputs.repo }}-${{ inputs.new_version }}.jar](https://repo1.maven.org/maven2/com/uid2/${{ inputs.repo }}/${{ inputs.new_version }}/${{ inputs.repo }}-${{ inputs.new_version }}.jar)\n\n## Changelog\n#{{UNCATEGORIZED}}",
Expand All @@ -60,17 +57,17 @@ runs:
GITHUB_TOKEN: ${{ inputs.github_token }}

- name: Create Docker Release
if: ${{ inputs.is_release == 'true' }}
if: ${{ inputs.is_release == 'true' && inputs.publish_platform == 'Docker' }}
uses: softprops/action-gh-release@v1
with:
name: ${{ inputs.is_release == 'true' && inputs.publish_platform == 'Docker'}}
name: v${{ inputs.new_version }}
body: ${{ steps.github_release_docker.outputs.changelog }}
draft: true

- name: Create Maven Release
if: ${{ inputs.is_release == 'true' && inputs.publish_platform == 'Maven'}}
uses: softprops/action-gh-release@v1
with:
name: ${{ inputs.version_number_input }}
name: v${{ inputs.new_version }}
body: ${{ steps.github_release_maven.outputs.changelog }}
draft: true

0 comments on commit db70628

Please sign in to comment.