Skip to content

Commit eee2e49

Browse files
committed
Github action to deploy to s3
1 parent 3ef58bf commit eee2e49

File tree

3 files changed

+36
-2
lines changed

3 files changed

+36
-2
lines changed

.github/workflows/deploy.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Deploy
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v3
16+
17+
- run: |
18+
sudo apt update &&
19+
sudo apt install -y ruby-rubygems ruby-dev awscli &&
20+
sudo gem install --no-document jekyll jekyll-paginate
21+
22+
- run: jekyll build
23+
24+
- name: Sync To S3
25+
run: |
26+
aws s3 sync --delete _site/ s3://${{ env.AWS_S3_BUCKET }}/ \
27+
--acl public-read --metadata-directive REPLACE \
28+
--cache-control max-age=300 --no-progress
29+
env:
30+
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
31+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
32+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
_site/
22
_drafts/
33
.jekyll-cache
4+
.secrets

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
AWS_PROFILE:=default
21
local:
32
jekyll serve --watch
43

@@ -7,4 +6,6 @@ build:
76

87
upload: build
98
aws s3 sync --delete _site/ s3://stathers.net/ --acl public-read --metadata-directive REPLACE --cache-control max-age=300
10-
# aws s3 cp --recursive s3://stathers.net/ s3://stathers.net/ --metadata-directive REPLACE --cache-control max-age=300
9+
10+
act:
11+
act --secret-file .secrets

0 commit comments

Comments
 (0)