From ae9cf42c795977fd193315b68d3a6126321d5217 Mon Sep 17 00:00:00 2001 From: Dan Allen Date: Mon, 2 Aug 2021 17:58:33 -0600 Subject: [PATCH] resolves #1050 fix upstream build to build against the specified ref --- .github/workflows/upstream-build.yaml | 5 +---- test-asciidoctor-upstream.sh | 19 +++++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/upstream-build.yaml b/.github/workflows/upstream-build.yaml index cbc971a1..53093b37 100644 --- a/.github/workflows/upstream-build.yaml +++ b/.github/workflows/upstream-build.yaml @@ -7,9 +7,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - with: - fetch-depth: 1 - ref: ${{ github.event.client_payload.branch }} - uses: actions/setup-java@v2 with: distribution: 'adopt' @@ -17,4 +14,4 @@ jobs: - name: Build run: | unset GEM_PATH GEM_HOME JRUBY_OPTS - ./test-asciidoctor-upstream.sh + ./test-asciidoctor-upstream.sh ${{ github.event.client_payload.branch }} diff --git a/test-asciidoctor-upstream.sh b/test-asciidoctor-upstream.sh index 6082eb6c..d8b4db30 100755 --- a/test-asciidoctor-upstream.sh +++ b/test-asciidoctor-upstream.sh @@ -1,16 +1,19 @@ #!/bin/bash -# This script runs the AsciidoctorJ tests against the specified tag (or master) of the Asciidoctor Ruby gem. +# This script runs the AsciidoctorJ tests against the specified ref of the Asciidoctor Ruby gem. GRADLE_CMD=./gradlew -# to build against a tag, set TAG to a git tag name (e.g., v1.5.2) -TAG=master -if [ "$TAG" == "master" ]; then - SRC_DIR=asciidoctor-master -else - SRC_DIR=asciidoctor-${TAG#v} +# to build against a tag, set REF to a git tag name (e.g., refs/tags/v1.5.2) +REF=refs/heads/master +if [ ! -z "$1" ]; then + REF=$1 + if [[ $REF != refs/* ]]; then + REF=refs/heads/$REF + fi fi +BASE_REF=${REF##*/} +SRC_DIR=asciidoctor-${BASE_REF#v} rm -rf build/maven && mkdir -p build/maven && cd build/maven -wget --quiet -O $SRC_DIR.zip https://github.com/asciidoctor/asciidoctor/archive/$TAG.zip +wget --quiet -O $SRC_DIR.zip https://github.com/asciidoctor/asciidoctor/archive/$REF.zip unzip -q $SRC_DIR.zip cp ../../asciidoctor-gem-installer.pom $SRC_DIR/pom.xml cd $SRC_DIR