Merge pull request #68 from zeldigas/renovate/io.ktor-ktor-bom-2.x #110
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and package | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- 'v*' | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Version to create release for if not empty' | |
required: false | |
default: '' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '11' | |
distribution: 'adopt' | |
cache: maven | |
# To handle both tag and manual runs, run a script that will define all required vars | |
- name: Define version to build | |
run: ./.github/define_release_version.sh ${{ github.event.inputs.version }} | |
# Building application | |
- name: Build with Maven | |
run: mvn --batch-mode verify -DversionSuffix=$RELEASE_VERSION_SUFFIX | |
- run: mkdir dist && cp cli/target/*.tar.gz dist | |
- uses: actions/upload-artifact@v3 | |
if: env.RELEASE_VERSION == '' | |
with: | |
name: cli.tar.gz | |
path: dist | |
retention-days: 20 | |
# Pushing to docker registry | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USER }} | |
password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./cli | |
push: true | |
tags: ${{ secrets.DOCKER_HUB_USER }}/text2confl:${{env.RELEASE_DOCKER_TAG}} | |
build-args: | | |
VERSION=${{env.RELEASE_VERSION_SUFFIX}} | |
cache-from: type=registry,ref=${{ secrets.DOCKER_HUB_USER }}/text2confl:buildcache | |
cache-to: type=registry,ref=${{ secrets.DOCKER_HUB_USER }}/text2confl:buildcache,mode=max | |
# If there is a tag trigger, creating release | |
- name: Compute changelog | |
run: ./.github/create_release_changes.sh | |
if: startsWith(github.ref, 'refs/tags/') | |
- name: Create github release | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
name: ${{env.RELEASE_VERSION}} | |
body_path: target/ci/CHANGELOG.md | |
token: ${{ secrets.RELEASE_TOKEN }} | |
files: | | |
dist/*.tar.gz | |
env: | |
GITHUB_REPOSITORY: zeldigas/text2confl |