-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (68 loc) · 2.42 KB
/
deploy.yml
File metadata and controls
75 lines (68 loc) · 2.42 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
name: Build and Deploy
run-name: Build and Deploy (${{ github.event.inputs.environment }})
on:
workflow_dispatch:
inputs:
environment:
description: 'Build environment'
type: environment
default: staging
required: true
branch:
description: 'Branch to checkout'
type: string
default: main
required: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: groupdocs-cloud/products2
ref: ${{ github.event.inputs.branch }}
token: ${{ secrets.REPO_TOKEN }}
- uses: actions/setup-node@v4
- run: npm install
- run: npm run build
env:
GROUPDOCS_CLOUD_CLIENT_ID: ${{ secrets.GROUPDOCS_CLOUD_CLIENT_ID }}
GROUPDOCS_CLOUD_CLIENT_SECRET: ${{ secrets.GROUPDOCS_CLOUD_CLIENT_SECRET }}
GTM_ID: ${{ secrets.GTM_ID }}
GPT_DATA_FETCH_BASEURL: ${{ secrets.GPT_DATA_FETCH_BASEURL }}
GPT_DATA_NO_CHECK: 1
NEXT_TELEMETRY_DISABLED: 1
NODE_OPTIONS: --max-old-space-size=5555
- name: Prepare artifacts
run: |
tar -cJf _next.tar.xz -C ${{ github.workspace }}/out ./_next
tar -cJf de.tar.xz -C ${{ github.workspace }}/out ./de
tar -cJf el.tar.xz -C ${{ github.workspace }}/out ./el
rm -rf ${{ github.workspace }}/out/{_next,de,el}
mv ${{ github.workspace }}/out/sitemap-*.xml .
tar -cJf sitemaps.tar.xz ./sitemap-*.xml
tar -cJf en.tar.xz -C ${{ github.workspace }}/out .
- uses: actions/upload-artifact@v3
with:
path: '*.tar.xz'
deploy:
needs: build
runs-on: ubuntu-latest
environment: ${{ github.event.inputs.environment }}
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
strategy:
matrix:
archive: [_next, en, de, el, sitemaps]
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
- name: Extract artifacts
run: |
tar xJf artifact/${{ matrix.archive }}.tar.xz
rm -rf artifact
- name: Upload to S3
run: aws s3 sync . s3://${{ secrets.AWS_S3_BUCKET }} --cache-control public,max-age=97969,must-revalidate