-
Notifications
You must be signed in to change notification settings - Fork 11
132 lines (114 loc) · 3.68 KB
/
deploy.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
---
name: Build and Deploy docs.rockylinux.org
concurrency:
group: production
cancel-in-progress: true
on:
push:
branches:
- main
workflow_dispatch:
repository_dispatch:
types: [deploy]
jobs:
build:
name: build
runs-on: ubuntu-latest
container:
image: quay.io/rockylinux/rockylinux:9
options: --user root
outputs:
DOCS_SHA: ${{steps.docs-sha.outputs.DOCS_SHA}}
environment: production
steps:
- name: Checkout mkdocs config
uses: actions/checkout@v4
- name: "Build Site"
uses: ./.github/actions/build-and-cache/
- name: set docs-sha
id: docs-sha
run: echo "DOCS_SHA=$DOCS_SHA" >> "$GITHUB_OUTPUT"
deploy:
name: deploy
needs: build
runs-on: ubuntu-latest
environment: production
steps:
- uses: actions/checkout@v4
with:
node-version: 20
# needs node
- uses: actions/cache@v4
id: docs-cache
with:
path: build/site/minified
key: cache-docs-${{ needs.build.outputs.DOCS_SHA }}
fail-on-cache-miss: false
enableCrossOsArchive: true
- name: Retrieve build artifacts
uses: actions/download-artifact@v4
with:
name: build-minified
path: |
build/minified/site
- name: Set up Fastly CLI
uses: fastly/compute-actions/setup@v6
with:
cli_version: 'latest'
token: ${{ secrets.GITHUB_TOKEN }}
- name: Install Dependencies
run: npm install
working-directory: ./compute-js
- name: restore cached fastly compute package
id: restore-fastly-cache
uses: actions/cache@v4
with:
path: |
pkg/*.tar.gz
key: cache-fastly-${{ steps.docs-sha.outputs.DOCS_SHA }}
- name: Build Compute Package
if: steps.restore-fastly-cache.outputs.cache-hit != 'true'
uses: fastly/compute-actions/build@v6
with:
verbose: false
project_directory: compute-js
env:
FASTLY_API_TOKEN: ${{ secrets.FASTLY_API_TOKEN }}
- name: Upload fastly compute package
uses: actions/upload-artifact@v4
with:
name: build-fastly-wasm
path: |
pkg/*.tar.gz
- name: cache fastly compute package
id: cache-fastly
uses: actions/cache@v4
with:
path: |
pkg/*.tar.gz
key: cache-fastly-${{ steps.docs-sha.outputs.DOCS_SHA }}
- name: Deploy Compute Package
uses: fastly/compute-actions/deploy@v6
with:
comment: 'Deployed via GitHub Actions'
project_directory: compute-js
env:
FASTLY_API_TOKEN: ${{ secrets.FASTLY_API_TOKEN }}
- name: Notify documentation channel about deployment Success
uses: mattermost/action-mattermost-notify@master
if: success() && !cancelled()
with:
MATTERMOST_WEBHOOK_URL: ${{ secrets.MM_WEBHOOK_URL }}
MATTERMOST_CHANNEL: documentation
TEXT: |
[Deployment](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) was completed :white_check_mark:
MATTERMOST_USERNAME: "Github"
- name: Notify documentation channel about deployment Failure
uses: mattermost/action-mattermost-notify@master
if: failure() && !cancelled()
with:
MATTERMOST_WEBHOOK_URL: ${{ secrets.MM_WEBHOOK_URL }}
MATTERMOST_CHANNEL: documentation
TEXT: |
[Deployment](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) failed :x:
MATTERMOST_USERNAME: "Github"