This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 219
64 lines (53 loc) · 2.05 KB
/
generate-zip.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
name: Generate ZIP file
on: [pull_request]
jobs:
generate-zip-file:
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-zip') }}
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@v4
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
uses: AbleLincoln/[email protected]
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
uses: ./.github/comments-aggregator
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
section-id: release-zip-url
order: 1
content: |
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