Skip to content

It is overkill to create a GitHub release for each push. It is nice t… #38

It is overkill to create a GitHub release for each push. It is nice t…

It is overkill to create a GitHub release for each push. It is nice t… #38

Workflow file for this run

# This workflow will build a Java project with Maven
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven
name: build
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
java: ['8','11','17', '21']
steps:
- uses: actions/checkout@v4
- name: Set up JDK ${{matrix.java}}
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: ${{matrix.java}}
cache: maven
- name: Maven -v
run: mvn -v
- name: Build with Maven
run: mvn -B package --file pom.xml
release-dev:
name: Create release - dev
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
if: github.ref != 'refs/heads/main'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
cache: maven
- name: Upload artifact
run: mvn -B deploy -Dgithub-release -e -Drevision=dev-${{ github.sha }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release:
name: Create release
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
cache: maven
- name: Upload artifact
run: mvn -B deploy -Dgithub-release -Drevision=${{ github.sha }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create release
id: create_release
uses: elgohr/Github-Release-Action@v5
with:
title: openhtmltopdf
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}