Skip to content

Add publishing

Add publishing #4

Workflow file for this run

name: Server builds
on:
push:
branches:
- '**'
tags:
- '**'
pull_request:
branches:
- '**'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Java 8
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
# - name: Cache .gradle
# uses: burrunan/gradle-cache-action@v1
# with:
# # Enable concurrent cache save and restore
# # Default is concurrent=false for better log readability
# concurrent: true
# # Disable caching of $HOME/.gradle/caches/*.*/generated-gradle-jars
# save-generated-gradle-jars: false
# # Disable publishing Gradle Build Scan URL to job report #Don't
# gradle-build-scan-report: true
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Build
run: ./gradlew build
release:
needs: build
runs-on: ubuntu-latest
if: github.ref_type == 'tag'
permissions:
contents: write
packages: write
steps:
- uses: actions/checkout@v3
- name: Get Version Name
id: version_name
run: |
echo version=${GITHUB_REF#refs/tags/v} >> $GITHUB_OUTPUT
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: Build with Gradle
uses: gradle/[email protected]
with:
arguments: publish
env:
KETTINGUSERNAME: ${{ secrets.KETTINGUSERNAME }}
KETTINGPASSWORD: ${{ secrets.KETTINGPASSWORD }}
VERSION: ${{ steps.version_name.outputs.version }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release
run: |
gh release create "v$VERSION" build/libs/mixingradle-$VERSION.jar build/libs/mixingradle-$VERSION-groovydoc.jar \
--repo="$GITHUB_REPOSITORY" \
--title="${GITHUB_REPOSITORY#*/} v$VERSION" \
--generate-notes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ steps.version_name.outputs.version }}