-
Notifications
You must be signed in to change notification settings - Fork 5
Set up deployment #519
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Set up deployment #519
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
c5fb6d8
Update `README.md` due to the site build on Hugo
JuliaEvseeva 76b046e
Update the site run and build commands
JuliaEvseeva 76badb8
Prepare the release script
JuliaEvseeva dbf3516
Add a note about Java version to build samples
JuliaEvseeva 379fca0
Test the GitHub Action locally
JuliaEvseeva 98ba306
Merge remote-tracking branch 'origin/migration-to-hugo' into update-r…
JuliaEvseeva 07ede4e
Merge branch 'delete-jekyll' into update-readme
JuliaEvseeva f8c5bfd
Update the build settings due to the structure update
JuliaEvseeva 1bdcc4d
Enable `robots.txt` for production
JuliaEvseeva 3b441d5
Improve the guide about how to edit content in Hugo
JuliaEvseeva d7988d0
Configure the link checker
JuliaEvseeva 8dc170f
Add the source content link to ignore
JuliaEvseeva 1229fa0
Add theme updates with the fixed links
JuliaEvseeva 1eef12c
Disable the test rule
JuliaEvseeva bdf8ae9
Remove the link to the previously used repository
JuliaEvseeva bf122dc
Get documentation updates
JuliaEvseeva 0d5b8c4
Configure Lychee to test the site locally
JuliaEvseeva b2b672b
Rename `check-links` action to `proof-links` to be corresponding with…
JuliaEvseeva cee3d17
Move `gitignore` to the root
JuliaEvseeva 3298a1a
Make the current year in the release notes automatically opened
JuliaEvseeva 39c4c64
Clean up `README`
JuliaEvseeva 3c0457a
Check code samples in the `documentation` repository
JuliaEvseeva c308e2a
Remove the `_docs` submodule with Jekyll implementation
JuliaEvseeva 0a53609
Clean up
JuliaEvseeva 7e93ae3
Change the theme GH user
JuliaEvseeva 253824a
Remove the `samples` that are now configured in `documentation`
JuliaEvseeva 70af64f
Improve `README`
JuliaEvseeva cce4c8a
Update credentials for `proof-links`
JuliaEvseeva 2282745
Do not install Lychee with `npm`
JuliaEvseeva a9d76fe
Remove the `config` submodule until it is needed to build the samples…
JuliaEvseeva 4da7e37
Clean up
JuliaEvseeva File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| name: Deploy to GitHub Pages | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - master | ||
|
|
||
| env: | ||
| HUGO_VERSION: 0.147.8 | ||
| GH_USER: site-commons-machine-user | ||
|
|
||
| jobs: | ||
| deploy: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| token: ${{ secrets.GH_SITE_COMMONS_PAT }} | ||
| submodules: true | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Setup Hugo | ||
| uses: peaceiris/actions-hugo@v3 | ||
| with: | ||
| hugo-version: ${{ env.HUGO_VERSION }} | ||
| extended: true | ||
|
|
||
| - name: Setup Node | ||
| uses: actions/setup-node@v3 | ||
| with: | ||
| node-version: '20' | ||
|
|
||
| - name: Cache dependencies | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: ~/.npm | ||
| key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-node- | ||
|
|
||
| - name: Cache Hugo Modules | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: /tmp/hugo_cache | ||
| key: ${{ runner.os }}-hugomod-${{ hashFiles('**/go.sum') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-hugomod- | ||
|
|
||
| - name: Prepare Environment | ||
| run: git config --global url."https://${{ env.GH_USER }}:${{ secrets.GH_SITE_COMMONS_PAT }}@github.com".insteadOf "https://github.com" | ||
|
|
||
| - name: Install Dependencies | ||
| working-directory: site | ||
| run: npm ci | ||
|
|
||
| - name: Build Spine | ||
| working-directory: site | ||
| run: hugo --minify | ||
|
|
||
| - name: Deploy | ||
| uses: peaceiris/actions-gh-pages@v4 | ||
| with: | ||
| github_token: ${{ secrets.GITHUB_TOKEN }} | ||
| publish_branch: gh-pages | ||
| publish_dir: ./site/public | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,37 +1,113 @@ | ||
| name: Proof Links | ||
| on: [pull_request, workflow_dispatch] | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - master | ||
| pull_request: | ||
| branches: | ||
| - master | ||
| env: | ||
| HUGO_VERSION: 0.147.8 | ||
| GH_USER: site-commons-machine-user | ||
| LYCHEE_RELEASE: "lychee-v0.15.1-x86_64-unknown-linux-gnu.tar.gz" | ||
| LYCHEE_VERSION_TAG: "v0.15.1" | ||
|
|
||
| jobs: | ||
| proof-links: | ||
| runs-on: ubuntu-latest | ||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Hugo | ||
| uses: peaceiris/actions-hugo@v3 | ||
| with: | ||
| hugo-version: ${{ env.HUGO_VERSION }} | ||
| extended: true | ||
|
|
||
| - name: Setup Node | ||
| uses: actions/setup-node@v3 | ||
| with: | ||
| node-version: '20' | ||
|
|
||
| - name: Cache dependencies | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: ~/.npm | ||
| key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-node- | ||
|
|
||
| - name: Cache Hugo Modules | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: /tmp/hugo_cache | ||
| key: ${{ runner.os }}-hugomod-${{ hashFiles('**/go.sum') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-hugomod- | ||
|
|
||
| - name: Prepare environment | ||
| run: git config --global url."https://${{ env.GH_USER }}:${{ secrets.GH_SITE_COMMONS_PAT }}@github.com".insteadOf "https://github.com" | ||
|
|
||
| - name: Install Dependencies | ||
| working-directory: site | ||
| run: npm ci | ||
|
|
||
| - name: Build Spine | ||
| working-directory: site | ||
| run: hugo -e development | ||
|
|
||
| # Cache Lychee results to avoid hitting rate limits. | ||
| - name: Cache Lychee results | ||
| uses: actions/cache@v4 | ||
| with: | ||
| submodules: 'recursive' | ||
| path: .lycheecache | ||
| key: cache-lychee-results | ||
|
|
||
| - name: Set up Ruby and Bundler | ||
| uses: ruby/setup-ruby@v1 | ||
| - name: Cache Lychee executable | ||
| id: cache-lychee | ||
| uses: actions/cache@v4 | ||
| with: | ||
| ruby-version: '2.7.4' | ||
|
|
||
| # Bundler version is restricted to `2.4.22`, | ||
| # as we want to use Ruby `2.7.4` to match GH Pages environment. | ||
| # | ||
| # Any newer versions of Bundler require Ruby 3.x, | ||
| # which are much newer than what's GH Pages has at the moment. | ||
| # | ||
| - name: Run Jekyll build | ||
| path: lychee | ||
| key: ${{ runner.os }}-${{ env.LYCHEE_RELEASE }} | ||
|
|
||
| # We use Lychee directly instead of a GitHub Action because it | ||
| # must have access the local Hugo server, which is not visible | ||
| # from the Docker-based action. | ||
| - name: Download Lychee executable | ||
| uses: robinraju/release-downloader@v1.7 | ||
| if: steps.cache-lychee.outputs.cache-hit != 'true' | ||
| with: | ||
| repository: "lycheeverse/lychee" | ||
| tag: ${{ env.LYCHEE_VERSION_TAG }} | ||
| fileName: ${{ env.LYCHEE_RELEASE }} | ||
|
|
||
| - name: Extract Lychee executable | ||
| if: steps.cache-lychee.outputs.cache-hit != 'true' | ||
| run: | | ||
| gem install bundler -v 2.4.22 | ||
| bundle install | ||
| bundle exec jekyll build | ||
| mkdir -p lychee && | ||
| tar -xf ${{ env.LYCHEE_RELEASE }} -C lychee | ||
|
|
||
| - name: Proof Links | ||
| run: ./_script/proof-links | ||
| # 1. In the generated HTML, some inner links will have absolute URLs and | ||
| # the link checker will attempt to fetch them. That's why we need | ||
| # a server. Sadly, link checkers have no settings to address this. | ||
| # 2. Output redirection is necessary for nohup in GitHub Actions. | ||
| # 3. Sleep makes sure the server is up before the next step. | ||
| - name: Start Hugo server | ||
| working-directory: site | ||
| run: | | ||
| nohup hugo server \ | ||
| --environment development \ | ||
| > nohup.out 2> nohup.err < /dev/null & | ||
| sleep 5 | ||
|
|
||
| - name: Check if the cache file exists | ||
| run: | | ||
| if [ -f ".lycheecache" ]; then | ||
| echo "Lychee cache exists." | ||
| else | ||
| echo "No lychee cache file." | ||
| fi | ||
|
|
||
| - name: Check links | ||
| run: | | ||
| ./lychee/lychee --config lychee.toml --timeout 60 \ | ||
| --base http://localhost:1313/ \ | ||
| 'site/public/**/*.html' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, I don't understand the idea. As we discussed vocally, this site is deployed in a "classic" way. I.e. by pushing the content to
master.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed, I've added this information to the pull request description.
The “classic” way by pushing the content to
masterwill work for Jekyll implementation, but not for Hugo. Here the script builds the site and placed it in thegh-pagesbranch.