-
Notifications
You must be signed in to change notification settings - Fork 5
132 lines (116 loc) · 4.58 KB
/
build_and_publish.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: Gatsby Publish
on:
push:
branches:
[ main ]
pull_request:
types: [ opened, synchronize, reopened ]
schedule: ## Do a run three times daily, to refresh website content
- cron: '25 22,04,12 * * *'
workflow_dispatch:
defaults:
run:
shell: bash
concurrency:
group: uses-github-api # do not allow any concurrency or the different builds will fight for the github rate limit and all take far longer
jobs:
unit-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '18'
cache: "npm" # this only caches global dependencies
- run: npm ci --prefer-offline
- run: npm run test
env:
CI: true
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get current date
id: date
run: |
echo "month=$(date +'%Y-%m')" >> "$GITHUB_OUTPUT"
echo "day=$(date +'%d')" >> "$GITHUB_OUTPUT"
- name: Restoring cached GitHub API results
uses: actions/cache@v3
with:
path: |
.cache-github-api
key: gatsby-build-github-queries-${{ steps.date.outputs.month }}-${{ steps.date.outputs.day }}-${{ github.run_id }}-${{ github.run_attempt }}
restore-keys: | # If there are multiple partial matches for a restore key, the action returns the most recently created cache.
gatsby-build-github-queries-${{ steps.date.outputs.month }}-${{ steps.date.outputs.day }}
gatsby-build-github-queries-
- uses: actions/setup-node@v4
with:
node-version: '18'
cache: "npm" # this only caches global dependencies
- run: npm ci --prefer-offline
- run: npm run build -- ${{ github.ref_name == 'main' && '--prefix-paths' || '' }}
env:
NODE_ENV: production
GATSBY_ACTIVE_ENV: production
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TABLEAU_PERSONAL_ACCESS_TOKEN: ${{ secrets.TABLEAU_PERSONAL_ACCESS_TOKEN }}
TABLEAU_SITE: ${{ secrets.TABLEAU_SITE }}
SEGMENT_KEY: ${{ secrets.SEGMENT_KEY }}
- name: Caching GitHub API results
uses: actions/cache/save@v3 # save the cache even if the integration tests fail
with:
path: |
.cache-github-api
key: gatsby-build-github-queries-${{ steps.date.outputs.month }}-${{ steps.date.outputs.day }}-${{ github.run_id }}-${{ github.run_attempt }}
- name: Raise defects if needed
uses: jbangdev/[email protected]
# Only try and raise defects on the main builds
if: "github.repository == 'quarkusio/extensions' && github.ref_name == 'main' && (github.event_name == 'push' || github.event_name == 'schedule')"
with:
script: site-validation/bad-image-issue.java
scriptargs: token=${{ secrets.GITHUB_TOKEN }} issueRepo=${{ github.repository }} runId=${{ github.run_id }} siteUrl=https://quarkus.io/extensions
- run: npm run test:int
env:
CI: true
PATH_PREFIX: "${{ github.ref_name == 'main' && 'extensions' || '' }}"
PATH_PREFIX_FLAG: "${{ github.ref_name == 'main' && '--prefix-paths' || '' }}"
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
eslintrc:
- '.eslint*'
# run eslint on all files if eslintrc changes
- name: Run eslint on changed files
uses: sibiraj-s/action-eslint@v3
with:
all-files: ${{ steps.filter.outputs.eslintrc == 'true' }}
- name: Store PR id
if: "github.event_name == 'pull_request'"
run: echo ${{ github.event.number }} > ./public/pr-id.txt
- name: Publishing directory for site deployment
uses: actions/upload-artifact@v3
with:
name: site
path: ./public
retention-days: 3
deploy:
# Only try and deploy on merged code
if: "github.repository == 'quarkusio/extensions' && github.ref_name == 'main' && (github.event_name == 'push' || github.event_name == 'schedule')"
needs: [ unit-test, build ]
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4 # not needed for the code, but needed for the git config
- name: Download Built site
uses: actions/download-artifact@v3
with:
name: site
path: site
- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: site # The folder the action should deploy.
branch: pages