Skip to content

Create release

Create release #5

Workflow file for this run

name: Create release and tag
on:
workflow_dispatch:
inputs:
release-type: # id of input
description: "prerelease, patch, minor or major"
required: true
default: "prerelease"
env:
REGISTRY: ghcr.io
IMAGE_NAME: smartparkingconfig
release-type: ${{ github.event.inputs.release-type }}
jobs:
build:
name: "Creating changelog and release"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: '0'
- name: generate tag and release body
run: |
RELEASE_TYPE=$(sh ${{ github.workspace }}/.github/workflows/getReleaseType.sh ${{ env.release-type }})
git config user.name github-smartparkingconfig
git config user.email [email protected]
npx standard-version -i CHANGELOG.md --release-as $RELEASE_TYPE
- name: Read CHANGELOG.md
id: package
uses: juliangruber/read-file-action@v1
with:
path: ./CHANGELOG.md
- name: Echo CHANGELOG.md
run: echo '${{ steps.package.outputs.content }}'
- name: publish tag
id: publish_tag
run: |
git push --follow-tags
echo ::set-output name=tag_name::$(git describe HEAD --abbrev=0)
- name: create release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_name: Release ${{ steps.publish_tag.outputs.tag_name }}
tag_name: ${{ steps.publish_tag.outputs.tag_name }}
body_path: CHANGELOG.md
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: 17
- name: Build with Maven
run: mvn clean -B package --file pom.xml
env:
CI: false
- name: Upload Maven build artifact
uses: actions/upload-artifact@v1
with:
name: artifact
path: application/target/application-0.0.1-SNAPSHOT.jar
- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.publish_tag.outputs.tag_name }}
- name: Build docker image with tag version and push to dockerhub
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: ghcr.io/smartparkingconfig
tags: ${{ steps.publish_tag.outputs.tag_name }}
path: .
dockerfile: ./Dockerfile