Skip to content

Commit

Permalink
Fix workflow configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
aalmiray committed Jan 11, 2022
1 parent 05b415d commit ce26961
Show file tree
Hide file tree
Showing 6 changed files with 265 additions and 206 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,67 +17,100 @@

name: Early Access

# trigger on push to branches and PR
on:
push:
branch:
pull_request:

jobs:
env:
GRAALVM_VERSION: '21.3.0'
JAVA_VERSION: '17'

jobs:
build:
name: 'Build with Graal on ${{ matrix.os }}'
if: startsWith(github.event.head_commit.message, 'Updated CHANGELOG.md') != true
if: startsWith(github.event.head_commit.message, 'Updated CHANGELOG.md') != true && startsWith(github.event.head_commit.message, '[maven-release-plugin]') != true
strategy:
fail-fast: true
fail-fast: false
matrix:
os: [ ubuntu-18.04, macOS-10.15, windows-2019 ]
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v1

- name: Set VERSION env var
run: echo "VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
- name: 'Checkout'
uses: actions/checkout@v2

- uses: bluwy/substitute-string-action@v1
id: os
with:
_input-text: '${{ runner.os }}'
Linux: linux
Windows: windows
MacOs: darwin
macOs: darwin
- name: 'Set vars'
shell: bash
run: |
OS=$(echo '${{ runner.os }}' | awk '{print tolower($0)}')
[[ $OS == 'ubuntu' ]] && echo "OS=linux" >> $GITHUB_ENV || echo "OS=$OS" >> $GITHUB_ENV
[[ $OS == 'macos' ]] && echo "OS=darwin" >> $GITHUB_ENV || echo "OS=$OS" >> $GITHUB_ENV
echo "VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
- name: 'Set up Graal'
uses: graalvm/setup-graalvm@v1
with:
version: '21.3.0'
java-version: '17 '
version: ${{ env.GRAALVM_VERSION }}
java-version: ${{ env.JAVA_VERSION }}
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: mvn clean verify
- name: 'Build native distribution'
run: ./mvnw clean verify -Pnative -Dmrm=false -B -ntp -e

- name: Upload daemon test logs
if: ${{ success() || failure() }}
- name: 'Upload daemon test logs'
if: always()
uses: actions/upload-artifact@v2
with:
name: daemon-test-logs-${{ steps.os.outputs.result }}
name: daemon-test-logs-${{ env.OS }}
path: integration-tests/target/mvnd-tests/**/daemon*.log

- name: Upload mvnd.zip
- name: 'Upload artifact'
uses: actions/upload-artifact@v2
with:
name: mvnd-${{ env.VERSION }}-${{ steps.os.outputs.result }}-amd64.zip
name: artifacts
path: dist/target/mvnd-*.zip

early-access:
runs-on: ubuntu-18.04
needs: [build]
# Only post early access releases when push to master
if: ${{ !github.event.issue.pull_request } && startsWith(github.ref, 'refs/heads/master')
if: ${{ !github.event.issue.pull_request }} && startsWith(github.ref, 'refs/heads/master')

steps:
- name: 'Checkout JReleaser'
uses: actions/checkout@v2
with:
repository: jreleaser/jreleaser
path: jreleaser

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

- uses: actions/cache@v2
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-cache-${{ 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') }}
restore-keys: |
${{ runner.os }}-gradlew-
- name: 'Install JReleaser'
run: |
cd jreleaser
./gradlew -Prelease=true publishToMavenLocal
- name: 'Check out repository'
uses: actions/checkout@v2
with:
Expand All @@ -89,7 +122,7 @@ jobs:
- name: 'Set up Java'
uses: actions/setup-java@v2
with:
java-version: 17
java-version: ${{ env.JAVA_VERSION }}
distribution: 'zulu'

- name: 'Cache Maven packages'
Expand All @@ -102,9 +135,9 @@ jobs:
- name: 'Release to GitHub'
env:
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./mvnw -B --file pom.xml -pl :mvnd -DartifactsDir=. jreleaser:release
run: ./mvnw -B --file pom.xml -pl :mvnd -DartifactsDir=artifacts jreleaser:release

- name: JReleaser output
- name: 'JReleaser output'
if: always()
uses: actions/upload-artifact@v2
with:
Expand Down
92 changes: 92 additions & 0 deletions .github/workflows/release-candidate-stage1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
#
# Copyright (c) 2017 Angelo Zerr and other contributors as
# indicated by the @author tags.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

name: Release Candidate - Stage1

# manual trigger
on:
workflow_dispatch:

env:
GRAALVM_VERSION: '21.3.0'
JAVA_VERSION: '17'

jobs:
build:
name: 'Build with Graal on ${{ matrix.os }}'
strategy:
fail-fast: true
matrix:
os: [ ubuntu-18.04, macOS-10.15, windows-2019 ]
runs-on: ${{ matrix.os }}

steps:
- name: 'Checkout'
uses: actions/checkout@v2

- name: 'Set vars'
shell: bash
run: |
OS=$(echo '${{ runner.os }}' | awk '{print tolower($0)}')
[[ $OS == 'ubuntu' ]] && echo "OS=linux" >> $GITHUB_ENV || echo "OS=$OS" >> $GITHUB_ENV
[[ $OS == 'macos' ]] && echo "OS=darwin" >> $GITHUB_ENV || echo "OS=$OS" >> $GITHUB_ENV
echo "VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
- name: 'Set up Graal'
uses: graalvm/setup-graalvm@v1
with:
version: ${{ env.GRAALVM_VERSION }}
java-version: ${{ env.JAVA_VERSION }}
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: 'Build native distribution'
run: ./mvnw clean verify -Pnative -Dmrm=false -B -ntp -e

- name: 'Upload daemon test logs'
if: always()
uses: actions/upload-artifact@v2
with:
name: daemon-test-logs-${{ env.OS }}
path: integration-tests/target/mvnd-tests/**/daemon*.log

release:
runs-on: ubuntu-18.04
needs: [build]

steps:
- name: 'Check out repository'
uses: actions/checkout@v2
with:
# required for triggering release-candidate-stage2
token: ${{ secrets.GIT_ACCESS_TOKEN }}

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

- name: 'Cache Maven packages'
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2

- name: 'Release'
run: ./mvnw -B --file pom.xml release:prepare
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,63 @@
# limitations under the License.
#

name: Release Candidate
name: Release Candidate - Stage2

# push on tag but not on 'early-access'
on:
workflow_dispatch:
push:
tags:
- '!early-access'

env:
GRAALVM_VERSION: '21.3.0'
JAVA_VERSION: '17'

jobs:
release:
runs-on: ubuntu-18.04
runs-on: ubuntu-latest

steps:
- name: 'Checkout JReleaser'
uses: actions/checkout@v2
with:
repository: jreleaser/jreleaser
path: jreleaser

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

- uses: actions/cache@v2
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-cache-${{ 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') }}
restore-keys: |
${{ runner.os }}-gradlew-
- name: 'Install JReleaser'
run: |
cd jreleaser
./gradlew -Prelease=true publishToMavenLocal
- name: 'Check out repository'
uses: actions/checkout@v2
with:
fetch-depth: 0

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

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

- name: 'Cache Maven packages'
Expand All @@ -51,7 +86,7 @@ jobs:
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./mvnw -B --file pom.xml -pl :mvnd -Pprerelease jreleaser:release

- name: JReleaser output
- name: 'JReleaser output'
if: always()
uses: actions/upload-artifact@v2
with:
Expand Down
Loading

0 comments on commit ce26961

Please sign in to comment.