From f1911722383a66cc7d28c2e8f7d1bd13cf40f935 Mon Sep 17 00:00:00 2001 From: Rodolfo Berrios <20590102+rodber@users.noreply.github.com> Date: Mon, 4 Oct 2021 09:31:38 -0300 Subject: [PATCH] feat: release artifacts #100 --- .github/workflows/release.yml | 68 +++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..e3510e6 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,68 @@ +name: Release + +on: + push: + tags: + - "*" + +jobs: + build: + runs-on: ${{ matrix.operating-system }} + strategy: + matrix: + operating-system: [ubuntu-latest] + php-versions: ["7.4"] + name: Release on PHP ${{ matrix.php-versions }} ${{ matrix.operating-system }} + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + env: + fail-fast: true + + - name: Validate composer + run: composer validate + + - name: Get composer cache directory + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + + - name: Cache dependencies + uses: actions/cache@v2 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ runner.os }}-composer- + + - name: Get version + id: get_version + run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} + + - name: Archive dev + uses: thedoctor0/zip-release@master + with: + type: "zip" + filename: "${{ steps.get_version.outputs.VERSION }}-dev.zip" + exclusions: "/*.git/* /*.github/*" + + - name: Install dependencies + run: composer install --prefer-dist --no-progress --classmap-authoritative --ignore-platform-reqs + + - name: Archive release + uses: thedoctor0/zip-release@master + with: + type: "zip" + filename: "${{ steps.get_version.outputs.VERSION }}.zip" + exclusions: "/*.git/* /*.github/*" + + - name: Upload artifacts + uses: ncipollo/release-action@v1 + with: + allowUpdates: true + removeArtifacts: true + artifacts: "${{ steps.get_version.outputs.VERSION }}.zip,${{ steps.get_version.outputs.VERSION }}-dev.zip" + token: ${{ secrets.GITHUB_TOKEN }}