Skip to content

Commit

Permalink
Automate blog deployment with Github Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
frioux committed Aug 23, 2021
1 parent 3570e47 commit 5d12ad3
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 22 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
on: [push]

jobs:
deploy:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- run: sudo apt-get update --quiet && sudo apt-get install --quiet awscli s3cmd libdbd-sqlite3-perl libyaml-syck-perl
- run: curl -Ss -L https://github.com/gohugoio/hugo/releases/download/v0.49/hugo_0.49_Linux-64bit.tar.gz > /tmp/x.tgz
- run: cd /tmp && tar xvf /tmp/x.tgz && mv hugo hugo-0.49
- run: cp etc/s3cmd.ini ~/.s3cfg
- run: cat /home/runner/.s3cfg
- run: PATH=$PATH:/tmp && cd /home/runner/work/blog/blog && make push
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
CF_AUTH_KEY: ${{ secrets.CF_AUTH_KEY }}
CF_AUTH_EMAIL: ${{ secrets.CF_AUTH_EMAIL }}
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ build: clean

push: build
git push --quiet
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)
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)
10 changes: 0 additions & 10 deletions bin/aws

This file was deleted.

10 changes: 0 additions & 10 deletions bin/s3cmd

This file was deleted.

4 changes: 3 additions & 1 deletion bin/set-redirects
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/dash
#!/bin/sh

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

redirect feed/index.html /index.xml
redirect feed/atom/index.html /index.xml

exit 0
60 changes: 60 additions & 0 deletions etc/s3cmd.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
[default]
access_token =
add_encoding_exts =
add_headers =
bucket_location = US
cache_file =
cloudfront_host = cloudfront.amazonaws.com
default_mime_type = binary/octet-stream
delay_updates = False
delete_after = False
delete_after_fetch = False
delete_removed = True
dry_run = False
enable_multipart = True
encoding = UTF-8
encrypt = False
expiry_date =
expiry_days =
expiry_prefix =
follow_symlinks = False
force = False
get_continue = False
gpg_command = /usr/bin/gpg
gpg_decrypt = %(gpg_command)s -d --verbose --no-use-agent --batch --yes --passphrase-fd %(passphrase_fd)s -o %(output_file)s %(input_file)s
gpg_encrypt = %(gpg_command)s -c --verbose --no-use-agent --batch --yes --passphrase-fd %(passphrase_fd)s -o %(output_file)s %(input_file)s
gpg_passphrase =
guess_mime_type = True
host_base = s3.amazonaws.com
host_bucket = %(bucket)s.s3.amazonaws.com
human_readable_sizes = False
ignore_failed_copy = False
invalidate_default_index_on_cf = False
invalidate_default_index_root_on_cf = True
invalidate_on_cf = False
list_md5 = False
log_target_prefix =
max_delete = -1
mime_type =
multipart_chunk_size_mb = 15
preserve_attrs = True
progress_meter = True
proxy_host =
proxy_port = 0
put_continue = False
recursive = False
recv_chunk = 4096
reduced_redundancy = False
restore_days = 1
send_chunk = 4096
server_side_encryption = False
simpledb_host = sdb.amazonaws.com
skip_existing = False
socket_timeout = 300
urlencoding_mode = normal
use_https = True
use_mime_magic = True
verbosity = WARNING
website_endpoint = http://%(bucket)s.s3-website-% (location)s.amazonaws.com/
website_error =
website_index = index.html

0 comments on commit 5d12ad3

Please sign in to comment.