Skip to content

Commit 5d12ad3

Browse files
committed
Automate blog deployment with Github Actions
1 parent 3570e47 commit 5d12ad3

6 files changed

Lines changed: 82 additions & 22 deletions

File tree

.github/workflows/cicd.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
on: [push]
2+
3+
jobs:
4+
deploy:
5+
runs-on: ubuntu-20.04
6+
steps:
7+
- uses: actions/checkout@v2
8+
- run: sudo apt-get update --quiet && sudo apt-get install --quiet awscli s3cmd libdbd-sqlite3-perl libyaml-syck-perl
9+
- run: curl -Ss -L https://github.com/gohugoio/hugo/releases/download/v0.49/hugo_0.49_Linux-64bit.tar.gz > /tmp/x.tgz
10+
- run: cd /tmp && tar xvf /tmp/x.tgz && mv hugo hugo-0.49
11+
- run: cp etc/s3cmd.ini ~/.s3cfg
12+
- run: cat /home/runner/.s3cfg
13+
- run: PATH=$PATH:/tmp && cd /home/runner/work/blog/blog && make push
14+
env:
15+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
16+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
17+
CF_AUTH_KEY: ${{ secrets.CF_AUTH_KEY }}
18+
CF_AUTH_EMAIL: ${{ secrets.CF_AUTH_EMAIL }}

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ build: clean
1616

1717
push: build
1818
git push --quiet
19-
cd public && s3cmd sync --delete-removed --disable-multipart --no-preserve /pwd/ s3://blog.afoolishmanifesto.com | tee $(log) && set-redirects && . ~/.cf-token && busted-urls $(log) && rm $(log)
19+
s3cmd sync --region us-west-2 --delete-removed --disable-multipart --no-preserve public/ s3://blog.afoolishmanifesto.com | tee $(log) && set-redirects && busted-urls $(log) && rm -f $(log)

bin/aws

Lines changed: 0 additions & 10 deletions
This file was deleted.

bin/s3cmd

Lines changed: 0 additions & 10 deletions
This file was deleted.

bin/set-redirects

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/dash
1+
#!/bin/sh
22

33
redirect() aws s3api copy-object \
44
--copy-source blog.afoolishmanifesto.com/$1 \
@@ -8,3 +8,5 @@ redirect() aws s3api copy-object \
88

99
redirect feed/index.html /index.xml
1010
redirect feed/atom/index.html /index.xml
11+
12+
exit 0

etc/s3cmd.ini

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
[default]
2+
access_token =
3+
add_encoding_exts =
4+
add_headers =
5+
bucket_location = US
6+
cache_file =
7+
cloudfront_host = cloudfront.amazonaws.com
8+
default_mime_type = binary/octet-stream
9+
delay_updates = False
10+
delete_after = False
11+
delete_after_fetch = False
12+
delete_removed = True
13+
dry_run = False
14+
enable_multipart = True
15+
encoding = UTF-8
16+
encrypt = False
17+
expiry_date =
18+
expiry_days =
19+
expiry_prefix =
20+
follow_symlinks = False
21+
force = False
22+
get_continue = False
23+
gpg_command = /usr/bin/gpg
24+
gpg_decrypt = %(gpg_command)s -d --verbose --no-use-agent --batch --yes --passphrase-fd %(passphrase_fd)s -o %(output_file)s %(input_file)s
25+
gpg_encrypt = %(gpg_command)s -c --verbose --no-use-agent --batch --yes --passphrase-fd %(passphrase_fd)s -o %(output_file)s %(input_file)s
26+
gpg_passphrase =
27+
guess_mime_type = True
28+
host_base = s3.amazonaws.com
29+
host_bucket = %(bucket)s.s3.amazonaws.com
30+
human_readable_sizes = False
31+
ignore_failed_copy = False
32+
invalidate_default_index_on_cf = False
33+
invalidate_default_index_root_on_cf = True
34+
invalidate_on_cf = False
35+
list_md5 = False
36+
log_target_prefix =
37+
max_delete = -1
38+
mime_type =
39+
multipart_chunk_size_mb = 15
40+
preserve_attrs = True
41+
progress_meter = True
42+
proxy_host =
43+
proxy_port = 0
44+
put_continue = False
45+
recursive = False
46+
recv_chunk = 4096
47+
reduced_redundancy = False
48+
restore_days = 1
49+
send_chunk = 4096
50+
server_side_encryption = False
51+
simpledb_host = sdb.amazonaws.com
52+
skip_existing = False
53+
socket_timeout = 300
54+
urlencoding_mode = normal
55+
use_https = True
56+
use_mime_magic = True
57+
verbosity = WARNING
58+
website_endpoint = http://%(bucket)s.s3-website-% (location)s.amazonaws.com/
59+
website_error =
60+
website_index = index.html

0 commit comments

Comments
 (0)