-
Notifications
You must be signed in to change notification settings - Fork 0
129 lines (123 loc) · 4.03 KB
/
build-tech-radar.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
name: Build Technology Radar
on:
workflow_dispatch: # allows triggering the workflow manually
pull_request:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/setup-node@v4
with:
node-version: "lts/*"
- uses: actions/cache@v4
with:
path: |
~/.npm
.techradar
key: ${{ runner.os }}-techradar-${{ hashFiles('**/package-lock.json') }}
- run: npm ci
- run: npm run build
- run: if [ -n "$(git status --porcelain)" ]; then echo 'workspace is dirty after rebuilding' ; git status ; git diff ; exit 1 ; fi
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: build
path: build
deploy-test:
needs: build
if: github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
environment:
name: techradar-test-aoe
url: http://techradar-test-aoe.s3-website.eu-central-1.amazonaws.com/techradar/
permissions:
id-token: write
contents: read
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@master
with:
aws-region: eu-central-1
role-to-assume: arn:aws:iam::511165248623:role/github_techradar
role-session-name: GitHubActions
- name: Download Artifact
uses: actions/download-artifact@v4
with:
name: build
path: build
- run: 'aws s3 sync --delete build/ s3://techradar-test-aoe/techradar/'
deploy:
needs: build
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
environment:
name: techradar
url: https://www.aoe.com/techradar/
permissions:
id-token: write
contents: read
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@master
with:
aws-region: eu-central-1
role-to-assume: arn:aws:iam::511165248623:role/github_techradar
role-session-name: GitHubActions
- name: Download Artifact
uses: actions/download-artifact@v4
with:
name: build
path: build
- run: 'aws s3 sync --delete build/ s3://techradar-prod-aoe/techradar/'
# deploy:
# runs-on: ubuntu-20.04
# if: github.ref == 'refs/heads/main'
# needs: build
# environment:
# name: techradar
# url: https://www.aoe.com/techradar/index.html
# steps:
# - name: Download Artifact
# uses: actions/download-artifact@v3
# with:
# name: build
# path: build
# - uses: jakejarvis/s3-sync-action@master
# with:
# args: --acl public-read
# env:
# AWS_S3_BUCKET: "techradar.aoe.com"
# AWS_ACCESS_KEY_ID: ${{ secrets.ACCESS_KEY }}
# AWS_SECRET_ACCESS_KEY: ${{ secrets.ACCESS_SECRET }}
# AWS_REGION: "eu-central-1"
# SOURCE_DIR: "build"
# DEST_DIR: "techradar"
#
# deploy-dev:
# runs-on: ubuntu-20.04
# if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
# needs: build
# environment:
# name: techradar-next
# url: http://techradar-next.aoe.com.s3.eu-central-1.amazonaws.com/techradar/index.html
# steps:
# - run: echo "WARNING! THIS DEPLOYS A STAGING ENV, RERUN THIS JOB TO GET YOUR CHANGES DEPLOYED TO STAGING"
# - name: Download Artifact
# uses: actions/download-artifact@v3
# with:
# name: build
# path: build
# - uses: jakejarvis/s3-sync-action@master
# with:
# args: --acl public-read
# env:
# AWS_S3_BUCKET: "techradar-next.aoe.com"
# AWS_ACCESS_KEY_ID: ${{ secrets.ACCESS_KEY }}
# AWS_SECRET_ACCESS_KEY: ${{ secrets.ACCESS_SECRET }}
# AWS_REGION: "eu-central-1"
# SOURCE_DIR: "build"
# DEST_DIR: "techradar"