diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..821bef5 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,26 @@ +name: create-release-artifact + +on: + release: + types: [published] + +jobs: + create-release-artifact: + name: Creating release artifact + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v2 + + - name: build artifact + run: composer run package && mv ./tmp/tawk-url-utils.zip tawk-url-utils.zip + + - name: upload artifact + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: ./tawk-url-utils.zip + asset_name: tawk-url-utils.zip + asset_content_type: application/zip diff --git a/.gitignore b/.gitignore index af95859..cfbcf3a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /vendor/ .phpunit.* .phpcs.cache +tmp diff --git a/composer.json b/composer.json index f55d28a..785114e 100644 --- a/composer.json +++ b/composer.json @@ -25,6 +25,8 @@ ], "test": "phpunit", "lint": "phpcs -p -s -v --runtime-set ignore_warnings_on_exit true .", - "lint:fix": "phpcbf -p -s -v .; err=$?; if [ $err -eq 1 ]; then exit 0; else exit $err; fi;" + "lint:fix": "phpcbf -p -s -v .; err=$?; if [ $err -eq 1 ]; then exit 0; else exit $err; fi;", + "package": "composer run clean && mkdir -p ./tmp && cp -rt ./tmp lib composer.json README.md CHANGELOG.md && cd tmp && zip -9 -rq ./tawk-url-utils.zip . -x 'tawk-url-utils.zip'", + "clean": "rm -rf ./tmp" } }