-
-
Notifications
You must be signed in to change notification settings - Fork 155
57 lines (55 loc) · 2.14 KB
/
draft.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
name: Website draft build
on:
pull_request:
branches:
- main
push:
branches:
- renovate/** # support automergeType=branch
# This configuration cancels previous runs if a new run is started on the same PR. Only one run at a time per PR.
# From https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-using-a-fallback-value
concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20.x
cache: yarn
- run: yarn install --frozen-lockfile
- run: yarn test:format
- run: yarn test:typings
- run: yarn sync
- run: yarn build
- name: Deploy to Draft to Netlify
if: ${{ !github.event.pull_request.head.repo.fork && !startsWith(github.ref, 'refs/heads/renovate') }}
id: deployment
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
shell: bash
run: |
netlify deploy --dir build --message '${{ github.event.commits[0].message }}' > log.tmp.txt 2>&1
cat log.tmp.txt | grep -E 'Website draft URL:' > log.txt
- name: Read deployment log
if: ${{ !github.event.pull_request.head.repo.fork && !startsWith(github.ref, 'refs/heads/renovate') }}
id: logs
uses: juliangruber/read-file-action@v1
with:
path: log.txt
- name: Comment PR with draft publish logs
if: ${{ !github.event.pull_request.head.repo.fork && !startsWith(github.ref, 'refs/heads/renovate') }}
id: create-comment
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
${{ steps.logs.outputs.content }}
- name: Comment debug
if: ${{ !github.event.pull_request.head.repo.fork && !startsWith(github.ref, 'refs/heads/renovate') }}
run: |
echo "Comment ID - ${{ steps.create-comment.outputs.comment-id }}"