-
Notifications
You must be signed in to change notification settings - Fork 166
57 lines (50 loc) · 1.79 KB
/
publish-netlify.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
---
#
# Copyright (c) 2020 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# NOTE: Because this worklow is using secrets, it cannot run directly on a pull-request workflow, which is running in the context of the forked repository.
name: Publish preview on netlify
on:
workflow_run:
workflows:
- "Build and validate pull request"
types:
- completed
jobs:
publish:
name: Publish preview on netlify
runs-on: ubuntu-22.04
steps:
- name: Download doc-content artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow: ${{ github.event.workflow_run.workflow_id }}
name: doc-content
path: content
- name: Set PR_NUMBER and PR_SHA variables
id: vars
run: |
echo "pr_number=$(<content/PR_NUMBER)" >> $GITHUB_OUTPUT
echo "pr_sha=$(<content/PR_SHA)" >> $GITHUB_OUTPUT
- name: Publish preview netlify
uses: netlify/actions/cli@master
id: netlify-publish
with:
args: deploy --dir=content/build/site --functions=functions
env:
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
- name: Update status comment
uses: actions-cool/maintain-one-comment@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
body: |
🎊 Navigate the preview: ${{ steps.netlify-publish.outputs.NETLIFY_URL }} 🎊
<!-- Sticky Pull Request Comment -->
body-include: "<!-- Sticky Pull Request Comment -->"
number: ${{ steps.vars.outputs.pr_number }}