Skip to content

Commit

Permalink
Updates workflow to publish jar as asset
Browse files Browse the repository at this point in the history
Signed-off-by: Sean Sundberg <[email protected]>
  • Loading branch information
seansund committed Jun 7, 2024
1 parent 4da6282 commit 63560ff
Show file tree
Hide file tree
Showing 7 changed files with 132 additions and 106 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/asset-publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Asset publish

on:
release:
types:
- published

jobs:
publish-assets:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.release.tag_name }}

- name: Set up JDK for x64
uses: actions/setup-java@v4
with:
distribution: 'temurin'
architecture: x64
cache: gradle

- name: Setup variables
id: variables
shell: bash
run: |
VERSION=$(cat gradle.properties | sed "s/version=//g")
echo "Version: ${VERSION}"
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Build asset
run: ./gradlew build

- name: Upload asset
id: upload-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./build/libs/openpages-support-${{ steps.variables.outputs.version }},jar
asset_name: openpages-support-${{ steps.variables.outputs.version }}.jar
asset_content_type: application/octet-stream
28 changes: 28 additions & 0 deletions .github/workflows/build-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Docker build

# Controls when the workflow will run
on:
pull_request:
branches:
- main

jobs:
verify:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up JDK for x64
uses: actions/setup-java@v4
with:
distribution: 'temurin'
architecture: x64
cache: gradle

- name: Test with Gradle
run: ./gradlew test

- name: Build with Gradle
run: ./gradlew build
102 changes: 0 additions & 102 deletions .github/workflows/docker-build.yaml

This file was deleted.

60 changes: 57 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,71 @@ on:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
verify:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up JDK for x64
uses: actions/setup-java@v4
with:
distribution: 'temurin'
architecture: x64
cache: gradle

- name: Test with Gradle
run: ./gradlew test

- name: Build with Gradle
run: ./gradlew build

release:
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Drafts your next Release notes as Pull Requests are merged into "master"
- uses: rlespinasse/[email protected]
- name: Checkout
uses: actions/checkout@v4

- uses: release-drafter/release-drafter@v5
- name: Create release
id: create-release
uses: release-drafter/release-drafter@v6
with:
# (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml
config-name: release-drafter.yaml
publish: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Setup variables
id: variables
shell: bash
run: |
VERSION=$(echo "${{ steps.create-release.outputs.tag_name }}" | | sed "s/v//g")
echo "Version: ${VERSION}"
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Update gradle.properties
run: echo "version=${{ steps.variables.outputs.version }}" > gradle.properties

- name: Commit gradle.properties
run: |
git config --local user.email [email protected]
git config --local user.name "Cloud-Native Toolkit"
git commit -a -m "Update version to ${{ steps.variables.outputs.version }}"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Publish release
id: publish-release
uses: release-drafter/release-drafter@v6
with:
config-name: release-drafter.yaml
publish: true
env:
Expand Down
1 change: 1 addition & 0 deletions .java-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8
1 change: 0 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ plugins {
}

group = 'com.ibm.openpages.support'
version = '1.0-SNAPSHOT'

repositories {
mavenCentral()
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
version=0.2.3

0 comments on commit 63560ff

Please sign in to comment.