-
Notifications
You must be signed in to change notification settings - Fork 1k
83 lines (71 loc) · 2.5 KB
/
create_pr_package.yaml
File metadata and controls
83 lines (71 loc) · 2.5 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
name: Create PR packages
on: pull_request_target
jobs:
create_pkg:
name: Create PR packages
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Checkout PR
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Setup node
uses: actions/setup-node@v1
with:
node-version: 14
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Build
run: yarn build
- name: Create packages
run: |
mkdir bin
for d in packages/*/ ; do
(cd "$d" && tgz=$(npm pack) && cp $tgz ../../bin/)
done
cd bin
sha="${{ github.event.pull_request.head.sha }}"
for f in * ; do
mv -- "$f" "${f%.tgz}-${sha:0:7}.tgz"
done
- name: copy files to s3
env:
aws_key_id: ${{ secrets.AWS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET }}
run: |
sudo apt-get update && sudo apt-get -y install awscli
aws configure set aws_access_key_id $aws_key_id
aws configure set aws_secret_access_key $aws_secret_access_key
aws configure set default.region us-east-1
aws s3 cp --recursive ./bin/ s3://rw-pr-redwoodjs-com/${{ github.event.number }}/
- name: Create comment msg
id: comment_msg
run: |
msg="📦 Packages for this PR can be downloaded from%0A"
for p in bin/*; do
msg+="https://rw-pr-redwoodjs-com.s3.amazonaws.com/${{ github.event.number }}/${p#bin/}%0A"
done
msg+="%0AInstall locally with yarn, e.g. \`yarn workspace web add <url>\`"
echo "::set-output name=msg::$msg"
- name: Find Comment
uses: peter-evans/find-comment@v1
id: fc
with:
issue-number: ${{ github.event.number }}
comment-author: 'github-actions[bot]'
- name: Create comment
if: ${{ steps.fc.outputs.comment-id == 0 }}
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: ${{ github.event.number }}
body: ${{ steps.comment_msg.outputs.msg }}
- name: Update comment
if: ${{ steps.fc.outputs.comment-id != 0 }}
uses: peter-evans/create-or-update-comment@v1
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
body: ${{ steps.comment_msg.outputs.msg }}
edit-mode: replace