Skip to content

Commit

Permalink
Improve instructions for hosting with AWS Amplify
Browse files Browse the repository at this point in the history
Closes #2781
  • Loading branch information
jmooring committed Dec 3, 2024
1 parent a07638a commit e0291f5
Show file tree
Hide file tree
Showing 11 changed files with 181 additions and 63 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
152 changes: 152 additions & 0 deletions content/en/hosting-and-deployment/hosting-on-amplify/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
---
title: Host on AWS Amplify
description: Host your site on AWS Amplify with continuous deployment.
categories: [hosting and deployment]
keywords: [hosting]
menu:
docs:
parent: hosting-and-deployment
toc: true
---

## Prerequisites

Please complete the following tasks before continuing:

1. [Create an AWS account]
2. [Install Git]
3. [Create a Hugo site] and test it locally with `hugo server`
4. Commit the changes to your local repository
5. Push the local repository to your [GitHub], [GitLab], or [Bitbucket] account

[Bitbucket]: https://bitbucket.org/product
[Create a Hugo site]: /getting-started/quick-start/
[Create an AWS account]: https://aws.amazon.com/resources/create-account/
[GitHub]: https://github.com
[GitLab]: https://about.gitlab.com/
[Install Git]: https://git-scm.com/book/en/v2/Getting-Started-Installing-Git

## Procedure

This procedure will enable continuous deployment from a GitHub repository. The procedure is essentially the same if you are using GitLab or Bitbucket.

Step 1
: Create a file named `amplify.yml` in the root of your project.

```sh
touch amplify.yml
```

Step 2
: Copy and paste the YAML below into the file you created. Change the application versions as needed.

```yaml
version: 1
env:
variables:
# Application versions
DART_SASS_VERSION: 1.81.0
GO_VERSION: 1.23.3
HUGO_VERSION: 0.139.3
# Time zone
TZ: America/Los_Angeles
# Cache
HUGO_CACHEDIR: ${PWD}/.hugo
NPM_CONFIG_CACHE: ${PWD}/.npm
frontend:
phases:
preBuild:
commands:
# Install Dart Sass
- curl -LJO https://github.com/sass/dart-sass/releases/download/${DART_SASS_VERSION}/dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz
- sudo tar -C /usr/local/bin -xf dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz
- rm dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz
- export PATH=/usr/local/bin/dart-sass:$PATH

# Install Go
- curl -LJO https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz
- sudo tar -C /usr/local -xf go${GO_VERSION}.linux-amd64.tar.gz
- rm go${GO_VERSION}.linux-amd64.tar.gz
- export PATH=/usr/local/go/bin:$PATH

# Install Hugo
- curl -LJO https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz
- sudo tar -C /usr/local/bin -xf hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz
- rm hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz
- export PATH=/usr/local/bin:$PATH

# Check installed versions
- go version
- hugo version
- node -v
- npm -v
- sass --embedded --version

# Install Node.JS dependencies
- "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci --prefer-offline || true"

# https://github.com/gohugoio/hugo/issues/9810
- git config --add core.quotepath false
build:
commands:
- hugo --gc --minify
- ./pagefind --site public
artifacts:
baseDirectory: public
files:
- '**/*'
cache:
paths:
- ${HUGO_CACHEDIR}/**/*
- ${NPM_CONFIG_CACHE}/**/*
```
Step 3
: Commit and push the change to your GitHub repository.
```sh
git add -A
git commit -m "Create amplify.yml"
git push
```

Step 4
: Log in to your AWS account and navigate to the [Amplify Console]. If this is your first project press the **Deploy an app** button, otherwise press the **Create new app** button.

[Amplify Console]: https://console.aws.amazon.com/amplify/apps

Step 5
: Choose a source code provider, then press the **Next** button.

![screen capture](amplify-step-05.png)

Step 6
: Authorize AWS Amplify to access your GitHub account.

![screen capture](amplify-step-06.png)

Step 7
: Select your personal account or relevant organization.

![screen capture](amplify-step-07.png)

Step 8
: Authorize access to one or more repositories.

![screen capture](amplify-step-08.png)

Step 9
: Select a repository and branch, then press the **Next** button.

![screen capture](amplify-step-09.png)

Step 10
: On the "App settings" page, scroll to the bottom then press the **Next** button. Amplify reads the `amplify.yml` file you created in Steps 1-3 instead of using the values on this page.

Step 11
: On the "Review" page, scroll to the bottom then press the **Save and deploy** button.

Step 12
: When your site has finished deploying, press the **Visit deployed URL** button to view your published site.

![screen capture](amplify-step-11.png)
46 changes: 0 additions & 46 deletions content/en/hosting-and-deployment/hosting-on-aws-amplify.md

This file was deleted.

17 changes: 13 additions & 4 deletions content/en/hosting-and-deployment/hosting-on-github/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ aliases: [/tutorials/github-pages-blog/]

## Prerequisites

Please complete the following tasks before continuing:

1. [Create a GitHub account]
2. [Install Git]
3. [Create a Hugo site] and test it locally with `hugo server`.
Expand Down Expand Up @@ -53,10 +55,11 @@ Step 4
{style="max-width: 280px"}

Step 5
: Create an empty file in your local repository.
: Create a file named `hugo.yaml` in a directory named `.github/worflows`.

```text
.github/workflows/hugo.yaml
mkdir -p .github/workflows
touch hugo.yaml
```

Step 6
Expand Down Expand Up @@ -144,7 +147,13 @@ jobs:
{{< /code >}}

Step 7
: Commit the change to your local repository with a commit message of something like "Add workflow", and push to GitHub.
: Commit and push the change to your GitHub repository.

```sh
git add -A
git commit -m "Create hugo.yaml"
git push
```

Step 8
: From GitHub's main menu, choose **Actions**. You will see something like this:
Expand Down Expand Up @@ -181,7 +190,7 @@ You may remove this step if your site, themes, and modules do not transpile Sass
[Dart Sass]: /hugo-pipes/transpile-sass-to-css/#dart-sass
## Additional resources
## Other resources
- [Learn more about GitHub Actions](https://docs.github.com/en/actions)
- [Caching dependencies to speed up workflows](https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows)
Expand Down
28 changes: 15 additions & 13 deletions content/en/hosting-and-deployment/hosting-on-netlify/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ toc: true

## Prerequisites

Please complete the following tasks before continuing:

1. [Create a Netlify account]
2. [Install Git]
3. [Create a Hugo site] and test it locally with `hugo server`
4. Commit the changes to your local repository
4. Push the local repository to your [GitHub], [GitLab], or [Bitbucket] account
5. Push the local repository to your [GitHub], [GitLab], or [Bitbucket] account

[Bitbucket]: https://bitbucket.org/product
[Create a Hugo site]: /getting-started/quick-start/
Expand All @@ -34,64 +36,64 @@ Step 1
Step 2
: Select your deployment method.

![screen capture](netlify-step-02.png)
![screen capture](netlify-step-02.png)

Step 3
: Authorize Netlify to connect with your GitHub account by pressing the **Authorize Netlify** button.

![screen capture](netlify-step-03.png)
![screen capture](netlify-step-03.png)

Step 4
: Press the **Configure Netlify on GitHub** button.

![screen capture](netlify-step-04.png)
![screen capture](netlify-step-04.png)

Step 5
: Install the Netlify app by selecting your GitHub account.

![screen capture](netlify-step-05.png)
![screen capture](netlify-step-05.png)

Step 6
: Press the **Install** button.

![screen capture](netlify-step-06.png)
![screen capture](netlify-step-06.png)

Step 7
: Click on the site's repository from the list.

![screen capture](netlify-step-07.png)
![screen capture](netlify-step-07.png)

Step 8
: Set the site name and branch from which to deploy.

![screen capture](netlify-step-08.png)
![screen capture](netlify-step-08.png)

Step 9
: Define the build settings, press the **Add environment variables** button, then press the **New variable** button.

![screen capture](netlify-step-09.png)
![screen capture](netlify-step-09.png)

Step 10
: Create a new environment variable named `HUGO_VERSION` and set the value to the [latest version].

[latest version]: https://github.com/gohugoio/hugo/releases/latest

![screen capture](netlify-step-10.png)
![screen capture](netlify-step-10.png)

Step 11
: Press the "Deploy my new site" button at the bottom of the page.

![screen capture](netlify-step-11.png)
![screen capture](netlify-step-11.png)

Step 12
: At the bottom of the screen, wait for the deploy to complete, then click on the deploy log entry.

![screen capture](netlify-step-12.png)
![screen capture](netlify-step-12.png)

Step 13
: Press the **Open production deploy** button to view the live site.

![screen capture](netlify-step-13.png)
![screen capture](netlify-step-13.png)

## Configuration file

Expand Down
1 change: 1 addition & 0 deletions content/en/methods/page/GitInfo.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ Some providers perform deep clones by default, others allow you to configure the

Hosting service | Default clone depth | Configurable
:-- | :-- | :--
AWS Amplify | Deep | N/A
Cloudflare Pages | Shallow | Yes [^CFP]
DigitalOcean App Platform | Deep | N/A
GitHub Pages | Shallow | Yes [^GHP]
Expand Down

0 comments on commit e0291f5

Please sign in to comment.