From afdb277b5f99bc3719160cd70611d4c16b02fc92 Mon Sep 17 00:00:00 2001 From: codepuncher Date: Wed, 27 Dec 2023 13:53:57 +0000 Subject: [PATCH] ci: add `release` workflow --- .github/workflows/release.yml | 52 +++++++++++++++++++++++++++++++++++ 1 file changed, 52 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..864f1be --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,52 @@ +# yamllint disable-line rule:document-start +name: release + +# yamllint disable-line rule:truthy +on: + push: + tags: + - "*.*.*" + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Setup PHP 8.1 + uses: shivammathur/setup-php@v2 + with: + php-version: 8.1 + env: + COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Build release + run: composer run-script release:build + + - uses: actions/upload-artifact@v4 + with: + name: gf-sagepay + path: release/*.zip + + lint-wp-org: + runs-on: ubuntu-latest + needs: build + steps: + - uses: actions/download-artifact@v4 + with: + name: gf-sagepay + - run: unzip gf-sagepay.zip -d /tmp/plugin-source-code + - run: find /tmp/plugin-source-code -name "*.php" -print0 | xargs -n 1 -0 php -l + + publish-to-github-releases: + runs-on: ubuntu-latest + needs: lint-wp-org + steps: + - uses: actions/checkout@v3 + - uses: actions/download-artifact@v4 + with: + name: gf-sagepay + - name: Create release + run: gh release create "${GITHUB_REF/refs\/tags\//}" gf-sagepay.zip --generate-notes + env: + GH_TOKEN: ${{ github.token }}