diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 756d556..87ea01d 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -18,7 +18,7 @@ jobs: job: [gen-dockerfiles] steps: - name: Checkout repository - uses: actions/checkout@v1 + uses: actions/checkout@v2 - name: Diff generated Docker files run: | make "${JOB}" diff --git a/.github/workflows/php-ci.yml b/.github/workflows/php-ci.yml index 25d55b2..4f0ac20 100644 --- a/.github/workflows/php-ci.yml +++ b/.github/workflows/php-ci.yml @@ -32,7 +32,7 @@ jobs: fail-fast: False steps: - name: Checkout repository - uses: actions/checkout@v1 + uses: actions/checkout@v2 - name: Show environment run: | @@ -91,18 +91,19 @@ jobs: - name: Set variables id: vars run: | - # Set git branch or git tag as slug - if [[ ${GITHUB_REF} =~ ^refs\/tags\/ ]]; then + # Detached from branch + if [ "$( git rev-parse --abbrev-ref HEAD )" = "HEAD" ]; then GIT_TYPE=TAG - GIT_SLUG="${GITHUB_REF/refs\/tags\//}" + GIT_SLUG="$( git tag --points-at HEAD | head -1 )" else GIT_TYPE=BRANCH - if [ -n "${GITHUB_HEAD_REF}" ]; then - GIT_SLUG="${GITHUB_HEAD_REF}" - else - GIT_SLUG="${GITHUB_REF/refs\/heads\//}" - fi + GIT_SLUG="$( git rev-parse --abbrev-ref HEAD )" fi + + # Output + echo "GIT_TYPE=${GIT_TYPE}" + echo "GIT_SLUG=${GIT_SLUG}" + # Export variable # https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#environment-files echo "GIT_TYPE=${GIT_TYPE}" >> $GITHUB_ENV diff --git a/.github/workflows/php-nightly.yml b/.github/workflows/php-nightly.yml index a37487f..1752d03 100644 --- a/.github/workflows/php-nightly.yml +++ b/.github/workflows/php-nightly.yml @@ -26,7 +26,7 @@ jobs: fail-fast: False steps: - name: Checkout repository - uses: actions/checkout@v1 + uses: actions/checkout@v2 - name: Show environment run: | @@ -82,7 +82,7 @@ jobs: - '8.1' refs: - 'master' - - '0.114' + - '0.118' steps: # ------------------------------------------------------------ @@ -97,16 +97,19 @@ jobs: - name: Set variables id: vars run: | - # Set git branch or git tag as slug - if [ -n "$( git tag --points-at HEAD )" ]; then + # Detached from branch + if [ "$( git rev-parse --abbrev-ref HEAD )" = "HEAD" ]; then GIT_TYPE=TAG - GIT_SLUG="$( git tag --points-at HEAD )" - elif [ "$( git rev-parse --abbrev-ref HEAD )" != "HEAD" ]; then + GIT_SLUG="$( git tag --points-at HEAD | head -1 )" + else GIT_TYPE=BRANCH GIT_SLUG="$( git rev-parse --abbrev-ref HEAD )" - else - false fi + + # Output + echo "GIT_TYPE=${GIT_TYPE}" + echo "GIT_SLUG=${GIT_SLUG}" + # Export variable # https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#environment-files echo "GIT_TYPE=${GIT_TYPE}" >> $GITHUB_ENV