Skip to content

debug EXCLUDES

debug EXCLUDES #3

Workflow file for this run

name: Release
on:
push:
branches:
- main
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Check if version has changed
id: check_version
run: |
VERSION=$(grep -oP "Version:\s*\K\d+(\.\d+)*" woocommerce-pos.php)
echo "VERSION=$VERSION" >> $GITHUB_ENV
git fetch --prune --unshallow
LAST_TAG=$(git describe --tags --abbrev=0)
if [[ "v$VERSION" == "$LAST_TAG" ]]; then
echo "Version has not changed. Skipping release..."
echo "::set-output name=release::false"
else
echo "Version has changed. Creating new release..."
echo "::set-output name=release::true"
fi
- name: Create Release
if: steps.check_version.outputs.release == 'true'
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ env.VERSION }}
release_name: Release v${{ env.VERSION }}
draft: true
prerelease: false
- name: Build
if: steps.check_version.outputs.release == 'true'
env:
YARN_ENABLE_IMMUTABLE_INSTALLS: false
run: |
yarn install
composer install --no-dev
yarn build:js
- name: Read .distignore
if: steps.check_version.outputs.release == 'true'
run: |
EXCLUDES=$(awk '{print "-x \42"$0"\42"}' .distignore | xargs)
echo "EXCLUDES=$EXCLUDES" >> $GITHUB_ENV
- name: Debug EXCLUDES
if: steps.check_version.outputs.release == 'true'
run: |
echo "Exclude string: $EXCLUDES"
- name: Compress and Upload ZIP
if: steps.check_version.outputs.release == 'true'
run: |
set -x
zip -r woocommerce-pos.zip . $EXCLUDES
set +x
gh release upload v${{ env.VERSION }} woocommerce-pos.zip --clobber
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}