Merge pull request #75 from lszeremeta/dependabot/github_actions/pete… #188
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: Create pre-release | |
on: | |
push: | |
branches: | |
- "master" | |
jobs: | |
test: | |
name: Build & test | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
java-version: [8, 11, 16] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK ${{ matrix.java-version }} | |
uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: ${{ matrix.java-version }} | |
- name: Cache local Maven repository | |
uses: actions/cache@v4 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- name: Build and test with Maven | |
run: mvn -B package --file pom.xml | |
pre-release: | |
name: GitHub pre-release | |
runs-on: ubuntu-latest | |
needs: test | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: 8 | |
- name: Cache local Maven repository | |
uses: actions/cache@v4 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- name: Build with Maven | |
run: mvn -B package --file pom.xml | |
- name: Wait for concurrent jobs | |
uses: softprops/turnstyle@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create pre-release | |
uses: "marvinpinto/action-automatic-releases@latest" | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
automatic_release_tag: "beta" | |
prerelease: true | |
title: "Development Build" | |
files: | | |
target/*.jar | |
docker-hub: | |
name: Docker Hub | |
runs-on: ubuntu-latest | |
needs: test | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Wait for concurrent jobs | |
uses: softprops/turnstyle@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Prepare | |
id: prep | |
run: | | |
DOCKER_IMAGE=lszeremeta/sdfeater | |
VERSION=latest | |
TAGS="${DOCKER_IMAGE}:${VERSION}" | |
echo ::set-output name=tags::${TAGS} | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Cache Docker layers | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Login to DockerHub | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- name: Build and push | |
id: docker_build | |
uses: docker/build-push-action@v5 | |
with: | |
builder: ${{ steps.buildx.outputs.name }} | |
file: Dockerfile | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.prep.outputs.tags }} | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache | |
- name: Update repo description | |
uses: peter-evans/dockerhub-description@v4 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASS }} | |
repository: lszeremeta/sdfeater |