Skip to content

Commit

Permalink
[build] Update workflow configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
aalmiray committed Mar 13, 2022
1 parent f5e5eac commit 47ded1f
Show file tree
Hide file tree
Showing 3 changed files with 115 additions and 92 deletions.
16 changes: 10 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ name: Build
on:
pull_request:

env:
JAVA_VERSION: '11'
JAVA_DISTRO: 'zulu'

jobs:
build:
name: Build
Expand All @@ -16,25 +20,25 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Set up Java
- name: Setup Java
uses: actions/setup-java@v2
with:
java-version: 11
distribution: 'zulu'
java-version: ${{ env.JAVA_VERSION }}
distribution: ${{ env.JAVA_DISTRO }}

- uses: actions/cache@v2
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-cache-${{ hashFiles('**/*.gradle') }}-${{ hashFiles('**/gradle.properties') }}
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}-${{ hashFiles('**/gradle.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- uses: actions/cache@v2
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradlew') }}
key: ${{ runner.os }}-gradlew-${{ hashFiles('**/gradlew') }}
restore-keys: |
${{ runner.os }}-gradlew-
- name: Build
run: ./gradlew build -S
run: ./gradlew build -S
65 changes: 41 additions & 24 deletions .github/workflows/early-access.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,44 +4,68 @@ on:
push:
branches: [ master ]

env:
JAVA_VERSION: '11'
JAVA_DISTRO: 'zulu'

jobs:
precheck:
name: Precheck
if: startsWith(github.event.head_commit.message, 'Releasing version') != true
runs-on: ubuntu-latest
outputs:
VERSION: ${{ steps.vars.outputs.VERSION }}
steps:
- name: Checkout
uses: actions/checkout@v2

- uses: n1hility/cancel-previous-runs@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Version
id: vars
shell: bash
run: |
echo ::set-output name=VERSION::$(cat VERSION)
build:
name: Build
needs: [precheck]
if: endsWith(${{ needs.precheck.outputs.VERSION }}, '-SNAPSHOT')
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
runs-on: ${{ matrix.os }}
if: github.repository == 'kordamp/ikonli' && startsWith(github.event.head_commit.message, 'Releasing version') != true

steps:
- uses: actions/checkout@v2

- name: Set up Java
- name: Setup Java
uses: actions/setup-java@v2
with:
java-version: 11
distribution: 'zulu'
java-version: ${{ env.JAVA_VERSION }}
distribution: ${{ env.JAVA_DISTRO }}

- uses: actions/cache@v2
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-cache-${{ hashFiles('**/*.gradle') }}-${{ hashFiles('**/gradle.properties') }}
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}-${{ hashFiles('**/gradle.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- uses: actions/cache@v2
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradlew') }}
key: ${{ runner.os }}-gradlew-${{ hashFiles('**/gradlew') }}
restore-keys: |
${{ runner.os }}-gradlew-
- name: Build
run: ./gradlew -Prelease=true build

- name: Jlink & JPackage
run: './gradlew -Prelease=true :ikonli-browser:jlinkZip :ikonli-browser:jpackage'
- name: Assemble
run: ./gradlew -Prelease=true :ikonli-browser:jlinkZip :ikonli-browser:jpackage

- name: Upload artifacts
uses: actions/upload-artifact@v2
Expand All @@ -57,9 +81,9 @@ jobs:
apps/ikonli-browser/build/packagers/ikonli-browser-*.pkg
apps/ikonli-browser/build/packagers/ikonli-browser-*.deb
earlyaccess:
name: EarlyAccess
needs: build
release:
name: Release
needs: [precheck, build]
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -70,26 +94,19 @@ jobs:
- name: Download build artifacts
uses: actions/download-artifact@v2

- name: Artifacts
run: ls -lR artifacts

- name: Set up Java
- name: Setup Java
uses: actions/setup-java@v2
with:
java-version: 11
distribution: 'zulu'

- name: Version
id: vars
run: echo ::set-output name=version::$(cat VERSION)
java-version: ${{ env.JAVA_VERSION }}
distribution: ${{ env.JAVA_DISTRO }}

- name: Release
uses: jreleaser/release-action@v1
with:
version: early-access
arguments: full-release -P artifactsDir=artifacts
env:
JRELEASER_PROJECT_VERSION: ${{ steps.vars.outputs.version }}
JRELEASER_PROJECT_VERSION: ${{ needs.precheck.outputs.VERSION }}
JRELEASER_GITHUB_TOKEN: ${{ secrets.GIT_ACCESS_TOKEN }}
JRELEASER_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }}
Expand All @@ -99,7 +116,7 @@ jobs:
if: always()
uses: actions/upload-artifact@v2
with:
name: jreleaser
name: jreleaser-release
path: |
out/jreleaser/trace.log
out/jreleaser/output.properties
126 changes: 64 additions & 62 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,86 +4,75 @@ on:
workflow_dispatch:
inputs:
version:
description: "Release version"
description: 'Release version'
required: true

env:
JAVA_VERSION: '11'
JAVA_DISTRO: 'zulu'

jobs:
version:
name: Version
precheck:
name: Precheck
runs-on: ubuntu-latest
if: github.repository == 'kordamp/ikonli'

outputs:
VERSION: ${{ steps.vars.outputs.VERSION }}
steps:
- uses: actions/checkout@v2

- name: Set release version
run: |
VERSION=${{ github.event.inputs.version }}
echo $VERSION > VERSION
sed -i -e "s/^\:project-version\:\ .*/:project-version: ${VERSION}/g" README.adoc
git add VERSION
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "GitHub Action"
git commit -a -m "Releasing version $VERSION"
git push origin master
git rev-parse HEAD > HEAD
- name: Checkout
uses: actions/checkout@v2

- name: Upload files
uses: actions/upload-artifact@v2
- uses: n1hility/cancel-previous-runs@v2
with:
name: artifacts
path: |
HEAD
token: ${{ secrets.GITHUB_TOKEN }}

- name: Version
id: vars
shell: bash
run: |
echo ::set-output name=VERSION::${{ github.event.inputs.version }}
build:
name: Build
needs: version
needs: [precheck]
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
runs-on: ${{ matrix.os }}

steps:
- name: Download all artifacts
uses: actions/download-artifact@v2

- name: Read HEAD ref
id: head
uses: juliangruber/read-file-action@v1
with:
path: artifacts/HEAD

- name: Check out repository
uses: actions/checkout@v2
with:
ref: ${{ steps.head.outputs.content }}

- name: Set up Java
- name: Setup Java
uses: actions/setup-java@v2
with:
java-version: 11
distribution: 'zulu'
java-version: ${{ env.JAVA_VERSION }}
distribution: ${{ env.JAVA_DISTRO }}

- uses: actions/cache@v2
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-cache-${{ hashFiles('**/*.gradle') }}-${{ hashFiles('**/gradle.properties') }}
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}-${{ hashFiles('**/gradle.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- uses: actions/cache@v2
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradlew') }}
key: ${{ runner.os }}-gradlew-${{ hashFiles('**/gradlew') }}
restore-keys: |
${{ runner.os }}-gradlew-
- name: Version
run: |
echo ${{ needs.precheck.outputs.VERSION }} > VERSION
- name: Build
run: ./gradlew -Prelease=true build

- name: Jlink & JPackage
run: './gradlew -Prelease=true :ikonli-browser:jlinkZip :ikonli-browser:jpackage'
- name: Assemble
run: ./gradlew -Prelease=true :ikonli-browser:jlinkZip :ikonli-browser:jpackage

- name: Upload artifacts
uses: actions/upload-artifact@v2
Expand All @@ -101,33 +90,46 @@ jobs:
release:
name: Release
needs: build
needs: [precheck, build]
runs-on: ubuntu-latest
steps:
# must read HEAD before checkout
- name: Download build artifacts
uses: actions/download-artifact@v2

- name: Read HEAD ref
id: head
uses: juliangruber/read-file-action@v1
with:
path: artifacts/HEAD

- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ steps.head.outputs.content }}
fetch-depth: 0

- name: Download build artifacts
uses: actions/download-artifact@v2

- name: Set up Java
- name: Setup Java
uses: actions/setup-java@v2
with:
java-version: 11
distribution: 'zulu'
java-version: ${{ env.JAVA_VERSION }}
distribution: ${{ env.JAVA_DISTRO }}

- uses: actions/cache@v2
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}-${{ hashFiles('**/gradle.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- uses: actions/cache@v2
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradlew-${{ hashFiles('**/gradlew') }}
restore-keys: |
${{ runner.os }}-gradlew-
- name: Version
run: |
echo ${{ needs.precheck.outputs.VERSION }} > VERSION
git add VERSION
sed -i -e "s/^\:project-version\:\ .*/:project-version: ${{ needs.precheck.outputs.VERSION }}/g" README.adoc
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "GitHub Action"
git commit -a -m "Releasing version ${{ needs.precheck.outputs.VERSION }}"
git push origin master
- name: Deploy
env:
Expand All @@ -138,14 +140,14 @@ jobs:
./gradlew -Prelease=true -Pfull-release=true \
-PsonatypeUsername=${{ secrets.SONATYPE_USERNAME }} \
-PsonatypePassword=${{ secrets.SONATYPE_PASSWORD }} \
build publishToSonatype closeAndReleaseSonatypeStagingRepository -S
build :ikonli-bom:publishToSonatype publishToSonatype closeAndReleaseSonatypeStagingRepository -S
- name: Release
uses: jreleaser/release-action@v1
with:
arguments: full-release -P artifactsDir=artifacts
env:
JRELEASER_PROJECT_VERSION: ${{ github.event.inputs.version }}
JRELEASER_PROJECT_VERSION: ${{ needs.precheck.outputs.VERSION }}
JRELEASER_GITHUB_TOKEN: ${{ secrets.GIT_ACCESS_TOKEN }}
JRELEASER_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }}
Expand All @@ -155,11 +157,11 @@ jobs:
JRELEASER_TWITTER_ACCESS_TOKEN: ${{ secrets.TWITTER_ACCESS_TOKEN }}
JRELEASER_TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}

- name: JReleaser output
- name: JReleaser release output
if: always()
uses: actions/upload-artifact@v2
with:
name: artifact
name: jreleaser-release
path: |
out/jreleaser/trace.log
out/jreleaser/output.properties
out/jreleaser/output.properties

0 comments on commit 47ded1f

Please sign in to comment.