Skip to content

Commit

Permalink
chore: update static-website action to ubuntu 24
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoIeni committed Oct 2, 2024
1 parent 645eba6 commit abc0268
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
14 changes: 12 additions & 2 deletions github-actions/static-websites/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
FROM ubuntu:bionic
FROM ubuntu:24.04

RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y git awscli
RUN set -eux; \
apt-get update; \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
git \
curl \
unzip \
; \
curl "https://awscli.amazonaws.com/awscli-exe-linux-$(arch).zip" -o "awscliv2.zip"; \
unzip awscliv2.zip; \
rm awscliv2.zip; \
./aws/install

COPY entrypoint.sh /entrypoint.sh

Expand Down
6 changes: 6 additions & 0 deletions github-actions/static-websites/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ cloudfront_distribution="${INPUT_CLOUDFRONT_DISTRIBUTION-}"

export AWS_ACCESS_KEY_ID="${INPUT_AWS_ACCESS_KEY_ID-}"
export AWS_SECRET_ACCESS_KEY="${INPUT_AWS_SECRET_ACCESS_KEY-}"
# The region is required by the AWS CLI, but it doesn't matter
# because CloudFront is a global service.
export AWS_DEFAULT_REGION="us-west-1"

# Ensure GitHub doesn't mess around with the uploaded file.
# Without the file, for example, files with an underscore in the name won't be
Expand All @@ -25,6 +28,9 @@ git add .
git commit -m "Deploy ${GITHUB_SHA} to gh-pages"
git push -f "https://x-token:${github_token}@github.com/${GITHUB_REPOSITORY}" master:gh-pages

# Print the AWS CLI version
aws --version

# Invalidate the CloudFront caches to prevent stale content from being served.
if [[ -n "${cloudfront_distribution}" ]]; then
aws cloudfront create-invalidation --distribution-id "${cloudfront_distribution}" --paths "/*"
Expand Down

0 comments on commit abc0268

Please sign in to comment.