diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..dd18762 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,18 @@ +# Files and directories excluded from git archive / release zips. +# The leading slash anchors a pattern to the repo root so that e.g. +# /vendor/ is excluded but includes/vendor/ is kept. + +/.github/ export-ignore +/.gitattributes export-ignore +/.gitignore export-ignore +/.wp-env.json export-ignore +/_build/ export-ignore +/docs/ export-ignore +/tests/ export-ignore +/vendor/ export-ignore +/composer.json export-ignore +/composer.lock export-ignore +/phpunit.xml export-ignore +/phpcs.xml export-ignore +/GitVersion.yml export-ignore +/README.md export-ignore diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7e8be8d..2b905ea 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -78,23 +78,11 @@ jobs: - uses: actions/checkout@v6 - name: Stage plugin under its slug directory + env: + VERSION: ${{ needs.version.outputs.fullSemVer }} run: | mkdir -p /tmp/ipquery - rsync -a \ - --exclude='.git' \ - --exclude='.github' \ - --exclude='.gitignore' \ - --exclude='.wp-env.json' \ - --exclude='docs' \ - --exclude='tests' \ - --exclude='/vendor' \ - --exclude='composer.json' \ - --exclude='composer.lock' \ - --exclude='phpunit.xml' \ - --exclude='phpcs.xml' \ - --exclude='GitVersion.yml' \ - --exclude='README.md' \ - ./ /tmp/ipquery/ + git archive HEAD | tar -x -C /tmp/ipquery - name: Run WordPress Plugin Check uses: wordpress/plugin-check-action@v1 @@ -155,24 +143,7 @@ jobs: env: VERSION: ${{ needs.version.outputs.fullSemVer }} run: | - mkdir -p /tmp/ipquery - rsync -a \ - --exclude='.git' \ - --exclude='.github' \ - --exclude='.gitignore' \ - --exclude='.wp-env.json' \ - --exclude='docs' \ - --exclude='tests' \ - --exclude='/vendor' \ - --exclude='composer.json' \ - --exclude='composer.lock' \ - --exclude='phpunit.xml' \ - --exclude='phpcs.xml' \ - --exclude='GitVersion.yml' \ - --exclude='README.md' \ - ./ /tmp/ipquery/ - cd /tmp - zip -r "ipquery-${VERSION}.zip" ipquery/ + git archive HEAD --format=zip --prefix=ipquery/ --output="/tmp/ipquery-${VERSION}.zip" echo "ZIP=/tmp/ipquery-${VERSION}.zip" >> "$GITHUB_ENV" - name: Publish GitHub Release diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 54e02f6..a9b590d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -72,21 +72,7 @@ jobs: - name: Stage plugin under its slug directory run: | mkdir -p /tmp/ipquery - rsync -a \ - --exclude='.git' \ - --exclude='.github' \ - --exclude='.gitignore' \ - --exclude='.wp-env.json' \ - --exclude='docs' \ - --exclude='tests' \ - --exclude='/vendor' \ - --exclude='composer.json' \ - --exclude='composer.lock' \ - --exclude='phpunit.xml' \ - --exclude='phpcs.xml' \ - --exclude='GitVersion.yml' \ - --exclude='README.md' \ - ./ /tmp/ipquery/ + git archive HEAD | tar -x -C /tmp/ipquery - name: Run WordPress Plugin Check uses: wordpress/plugin-check-action@v1