2022-07-22 11:48:54 +00:00
|
|
|
name: Generate ZIP file
|
|
|
|
|
|
|
|
on: [pull_request]
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
generate-zip-file:
|
2023-02-17 08:32:50 +00:00
|
|
|
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-zip') }}
|
2022-07-22 11:48:54 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Cache node_modules
|
|
|
|
id: cache-node-modules
|
|
|
|
uses: actions/cache@v3
|
|
|
|
env:
|
|
|
|
cache-name: cache-node-modules
|
|
|
|
with:
|
|
|
|
path: node_modules
|
|
|
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
|
|
|
|
|
|
|
- name: Setup node version and npm cache
|
|
|
|
uses: actions/setup-node@v3
|
|
|
|
with:
|
|
|
|
node-version-file: '.nvmrc'
|
|
|
|
cache: 'npm'
|
|
|
|
|
|
|
|
- name: Install Node dependencies
|
|
|
|
if: steps.cache-node-modules.outputs.cache-hit != 'true'
|
|
|
|
run: npm ci --no-optional
|
|
|
|
|
|
|
|
- name: Generate ZIP file
|
|
|
|
run: npm run package-plugin:deploy
|
|
|
|
|
|
|
|
- name: Create temp folder
|
|
|
|
run: mkdir wc-blocks-pr-release__temp
|
|
|
|
|
|
|
|
- name: Rename and move ZIP file
|
|
|
|
run: mv woocommerce-gutenberg-products-block.zip wc-blocks-pr-release__temp/woocommerce-gutenberg-products-block-${{ github.event.pull_request.number }}.zip
|
|
|
|
|
|
|
|
- name: Transfer ZIP file via SFTP
|
2023-04-18 12:49:47 +00:00
|
|
|
uses: AbleLincoln/push-to-sftp@v2.0
|
2022-07-22 11:48:54 +00:00
|
|
|
with:
|
|
|
|
host: ${{ secrets.FTP_HOST }}
|
|
|
|
port: 22
|
|
|
|
username: ${{ secrets.FTP_USER }}
|
|
|
|
password: ${{ secrets.FTP_PASS }}
|
|
|
|
sourceDir: ./wc-blocks-pr-release__temp/
|
|
|
|
targetDir: ${{ secrets.FTP_DIR }}
|
|
|
|
|
|
|
|
- name: Add release ZIP URL as comment to the PR
|
2022-12-21 15:24:01 +00:00
|
|
|
uses: ./.github/comments-aggregator
|
2022-07-22 11:48:54 +00:00
|
|
|
with:
|
2022-12-21 15:24:01 +00:00
|
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
section-id: release-zip-url
|
|
|
|
order: 1
|
|
|
|
content: |
|
2022-07-22 11:48:54 +00:00
|
|
|
The release ZIP for this PR is accessible via:
|
|
|
|
```
|
|
|
|
https://wcblocks.wpcomstaging.com/wp-content/uploads/woocommerce-gutenberg-products-block-${{ github.event.pull_request.number }}.zip
|
|
|
|
```
|
|
|
|
|
|
|
|
- name: Delete ZIP file
|
|
|
|
run: rm -rf wc-blocks-pr-release__temp
|