-
Notifications
You must be signed in to change notification settings - Fork 0
109 lines (96 loc) · 3.47 KB
/
docs.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
######################################################################
# Workflow that zip, uploads artifact and notify SNS to start pipeline.
# trigger build, and againand again, and again.
######################################################################
name: 'Docs'
on:
push:
branches:
- master
paths:
- '.github/workflows/docs.yml'
- 'apps/docs/**'
jobs:
terraform:
defaults:
run:
working-directory: ./apps/docs
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set outputs
id: vars
shell: bash
run: |
echo "::set-output name=application::docs"
echo "::set-output name=branch::$(echo ${GITHUB_REF#refs/heads/})"
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Zip And Upload Folder
id: zip_and_upload
shell: bash
run: |
ARTIFACT_FILENAME=${{ steps.vars.outputs.application }}-${{ steps.vars.outputs.branch }}-${{ steps.vars.outputs.sha_short }}.zip
S3_FILENAME=s3://${{ secrets.AWS_BUCKET }}/$ARTIFACT_FILENAME
zip -r $ARTIFACT_FILENAME terraform
aws s3 cp $ARTIFACT_FILENAME $S3_FILENAME
echo "::set-output name=s3_filename::$S3_FILENAME"
echo "::set-output name=artifact_filename::$ARTIFACT_FILENAME"
- name: Uploaded file
run: |
echo ${{ steps.zip_and_upload.outputs.s3_filename }}
echo ${{ steps.zip_and_upload.outputs.artifact_filename }}
- name: Publish SNS Topic
uses: nothingalike/[email protected]
with:
TOPIC_ARN: ${{ secrets.TOPIC_ARN }}
MESSAGE: |
{
"reference":"${{ steps.zip_and_upload.outputs.s3_filename }}",
"name": "${{ steps.vars.outputs.application }}",
"commit": "${{ steps.vars.outputs.sha_short }}",
"branch": "${{ steps.vars.outputs.branch }}",
}
docs:
defaults:
run:
working-directory: ./apps/docs/docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set outputs
id: vars
shell: bash
run: |
echo "::set-output name=application::docs"
echo "::set-output name=branch::$(echo ${GITHUB_REF#refs/heads/})"
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
- uses: actions/checkout@v2
-
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: "Build Site"
run: bundle exec jekyll build
env:
JEKYLL_ENV: productions
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Sync documentation.
shell: bash
run: |
aws s3 sync ./_site \
s3://198596758466-docs/${{ steps.vars.outputs.application }}/${{ steps.vars.outputs.branch }} \
--acl public-read \
--delete