Merge pull request #168 from zeldigas/feature/GH-162_kroki_asciidoc #201
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@v4 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v4 | |
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@v4 | |
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@v3 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USER }} | |
password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./cli | |
platforms: linux/amd64,linux/arm64 | |
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@v2 | |
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 |