-
Notifications
You must be signed in to change notification settings - Fork 1
63 lines (52 loc) · 1.96 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
name: Generate ZIP file
on: [pull_request]
jobs:
generate-zip-file:
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
uses: AbleLincoln/push-to-sftp@v1.0
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: mshick/add-pr-comment@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
message: |
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
```
allow-repeats: false
- name: Delete ZIP file
run: rm -rf wc-blocks-pr-release__temp