From d560a08e9d8eb0d09e3834b331ccfb2d92961343 Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 24 Jun 2024 08:32:23 +0200 Subject: [PATCH] Add manual release creation action --- .github/workflows/create_release.yaml | 34 +++++++++++++++++++ .github/workflows/pull_request.yaml | 47 +++++++++++++++++++++++++++ .github/workflows/release.yaml | 22 ------------- 3 files changed, 81 insertions(+), 22 deletions(-) create mode 100644 .github/workflows/create_release.yaml create mode 100644 .github/workflows/pull_request.yaml delete mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/create_release.yaml b/.github/workflows/create_release.yaml new file mode 100644 index 0000000..3582b99 --- /dev/null +++ b/.github/workflows/create_release.yaml @@ -0,0 +1,34 @@ +name: Create release + +on: + workflow_dispatch: + inputs: + version: + description: 'Version to create' + required: true + +jobs: + create_release: + runs-on: ubuntu-latest + steps: + - name: Checkout source + uses: actions/checkout@v3 + + - uses: shivammathur/setup-php@v2 + with: + php-version: 5.6 + extensions: none, curl, dom, mbstring, simplexml, tokenizer, xml, xmlwriter, json + coverage: none + + - run: git archive --output=tpay-openapi-php.zip HEAD + + - run: zip -ur tpay-openapi-php.zip vendor/ + + - name: Create Github release + uses: ncipollo/release-action@v1 + with: + tag: ${{ github.event.inputs.version }} + name: "v${{ github.event.inputs.version }}" + generateReleaseNotes: true + artifacts: tpay-openapi-php.zip + diff --git a/.github/workflows/pull_request.yaml b/.github/workflows/pull_request.yaml new file mode 100644 index 0000000..ef52a7a --- /dev/null +++ b/.github/workflows/pull_request.yaml @@ -0,0 +1,47 @@ +name: Pull request + +on: + pull_request: + +permissions: + contents: write + +jobs: + check: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - uses: shivammathur/setup-php@v2 + with: + php-version: 5.6 + extensions: none, curl, dom, mbstring, simplexml, tokenizer, xml, xmlwriter, json + coverage: none + + - run: composer install --no-dev + + - run: chmod 777 -R vendor + + - run: git archive --output=tpay-openapi-php.zip HEAD + + - run: zip -ur tpay-openapi-php vendor/ + + - run: mkdir sdk && unzip tpay-openapi-php.zip -d plugin + + - uses: actions/upload-artifact@v4 + id: plugin-upload + with: + name: 'tpay-woocommerce' + path: 'sdk/' + + - uses: actions/github-script@v6 + with: + github-token: ${{ secrets.TOKEN }} + script: | + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: 'Tpay OpenAPI SDK - ${{ steps.plugin-upload.outputs.artifact-url }}' + }) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml deleted file mode 100644 index 809fb1d..0000000 --- a/.github/workflows/release.yaml +++ /dev/null @@ -1,22 +0,0 @@ -name: Release - -on: - push: - tags: - - '*' - -permissions: - contents: write - -jobs: - check: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - - run: git archive --output=tpay-openapi-php.zip HEAD - - - uses: softprops/action-gh-release@v1 - with: - files: tpay-openapi-php.zip