Skip to content
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

Merge before moving repo to ACCESS-NRI GitHub organization #647

Merged
merged 31 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
1f16485
-Updated workflows setup-python action from v4 to v5;\n-Updated requi…
atteggiani Jan 12, 2024
66c6faf
Merge branch 'development' of github.com:ACCESS-Hive/access-hive.gith…
atteggiani Jan 12, 2024
939e7b4
Updated workflows. Now the checkout action does not checkout 'main' b…
atteggiani Jan 12, 2024
7a48f8a
Updated 'pandoc' package version in requirements.txt
atteggiani Jan 12, 2024
bba0b4f
Updated setup-python version in workflows to install Python 3.9.x
atteggiani Jan 12, 2024
15e88e9
Added info on overview of ACCESS models inside General Prerequisites,…
atteggiani Jan 12, 2024
e4e2c70
Updated workflows to show development website link when there is a PR…
atteggiani Jan 12, 2024
8957f24
Added job to run only if anything previous fails, to change the previ…
atteggiani Jan 12, 2024
c342841
Try failing message in the preview
atteggiani Jan 12, 2024
461dccd
Try failing message in the preview
atteggiani Jan 12, 2024
ae2852e
Updated workflows to fix error that prevented setup previews to fire …
atteggiani Jan 12, 2024
83922ff
Update workflows for failing jobs
atteggiani Jan 14, 2024
987a9cd
Try failing job to check if fail workfklow works
atteggiani Jan 14, 2024
73063c6
Try failing job to check if fail workfklow works
atteggiani Jan 14, 2024
89c588a
Try failing job to check if fail workfklow works
atteggiani Jan 14, 2024
16b7a40
Updated workflows
atteggiani Jan 14, 2024
cce8da4
Merge pull request #638 from ACCESS-Hive/davide/add-initial-info-in-h…
atteggiani Jan 14, 2024
4401f06
Moved the 'drafts' directory outside of the 'docs' directory, to make…
atteggiani Jan 16, 2024
d85aaf2
Merge pull request #641 from ACCESS-Hive/davide/make-content-of-draft…
atteggiani Jan 16, 2024
8b6d0a7
Fix broken link for license
atteggiani Jan 17, 2024
660fb22
minor edit to delete_all_artifacts.sh
atteggiani Jan 19, 2024
8e622dc
minor edito to workflow context keywords to get rid of harcoded insta…
atteggiani Jan 19, 2024
bcca796
Get url from CNAME file
atteggiani Jan 19, 2024
65f1a83
Get url from CNAME file
atteggiani Jan 19, 2024
6ba5cc8
Fixed path for CNAME file
atteggiani Jan 19, 2024
3db1593
testing
atteggiani Jan 19, 2024
864a1be
Fixed
atteggiani Jan 19, 2024
756883d
Merge pull request #646 from ACCESS-Hive/workflow-test
atteggiani Jan 19, 2024
ee72b21
Updated workflows to display date in AEDT
atteggiani Jan 21, 2024
f3031c2
Fixed workflows to show date in AEDT
atteggiani Jan 21, 2024
1f00a66
fixed
atteggiani Jan 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/delete_all_artifacts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ invoke_api() {
}

list_artifacts() {
invoke_api https://api.github.com/repos/ACCESS-Hive/access-hive.github.io/actions/artifacts
org=ACCESS-Hive
repo=access-hive.github.io
invoke_api https://api.github.com/repos/${org}/${repo}/actions/artifacts
}

list=$(list_artifacts | jq '.artifacts | .[] | .url')
Expand Down
195 changes: 158 additions & 37 deletions .github/workflows/deploy_to_github_pages.yml
Original file line number Diff line number Diff line change
@@ -1,63 +1,103 @@
name: Deploy to GitHub Pages
on:
push: #Action fires anytime there is a push to the following branches
branches:
branches:
- main
- development
pull_request: #Action also fires anytime a PR is (re)opened, closed or synchronized
types:
types:
- opened
- reopened
- synchronize
- closed
env:
TZ: Australia/Canberra

jobs:
pr-preview-setup:
# If the action is fired because of a PR, and the PR is not from the development branch, run this job
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref != 'development' }}
# If the action is fired because of a PR, run this job
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
steps:
- name: Get date
run: echo "DATE=$(date '+%Y-%m-%d %H:%M %Z')" >> $GITHUB_ENV

- name: Setup pr-preview
# If the PR is new (or has been reopened), setup the message that will
# get updated with the URL after deployment
if: ${{ github.event.action == 'opened' || github.event.action == 'reopened' }}
# If the PR is not from the development branch and is new (or has been reopened),
# setup the message that will get updated with the URL after deployment
if: ${{ github.event.pull_request.head.ref != 'development' && github.event.action != 'closed' }}
uses: thollander/[email protected]
with:
comment_tag: pr-preview
pr_number: ${{ github.event.number }}
message: "\
PR Preview
PR preview

:---:

🛫 Deployment still ongoing.<br>
Preview URL will be available at the end of the deployment.

For more information, please check the [Actions](https://github.com/${{ github.repository }}/actions) tab.

${{ env.DATE }}
"

- name: Setup development preview
# If the PR is from the development branch and is new (or has been reopened),
# setup the message that will get updated with the URL after deployment
if: ${{ github.event.pull_request.head.ref == 'development' && github.event.action != 'closed' }}
uses: thollander/[email protected]
with:
comment_tag: pr-preview
pr_number: ${{ github.event.number }}
message: "\
Development website preview

:---:

🛫 Deployment still ongoing.<br>
Preview URL will be available at the end of the deployment.
For more information, please check the [Actions](https://github.com/ACCESS-Hive/access-hive.github.io/actions) tab.

For more information, please check the [Actions](https://github.com/${{github.repository}}/actions) tab.

${{ env.DATE }}
"

# If the PR is closed, remove the pr-preview URL
- name: Remove pr-preview URL
if: ${{github.event.action == 'closed'}}
- name: Remove pr-preview URL link
if: ${{github.event.action == 'closed' && github.event.pull_request.head.ref != 'development' }}
uses: thollander/[email protected]
with:
comment_tag: pr-preview
pr_number: ${{ github.event.number }}
message: "\
PR Preview

:---:


🛬 Link removed because the pull request was closed.

${{ env.DATE }}
"

# If the PR is closed, remove the development URL
- name: Remove development URL
if: ${{github.event.action == 'closed' && github.event.pull_request.head.ref == 'development' }}
uses: thollander/[email protected]
with:
comment_tag: pr-preview
pr_number: ${{ github.event.number }}
message: "\
Development website preview

:---:

🛬 Preview removed because the pull request was closed.

${{ env.DATE }}
"

build:
# Cancel any previous build/deploy jobs that are still running (no need to build/deploy multiple times)
concurrency:
Expand All @@ -66,20 +106,23 @@ jobs:
runs-on: ubuntu-latest
outputs:
pr_nums: ${{ steps.build.outputs.pr_nums }}
url: ${{ steps.url.outputs.url }}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: main


- name: Get URL
id: url
run: echo "url=$(cat docs/CNAME)" >> "$GITHUB_OUTPUT"

- name: Python setup
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.x
python-version: 3.9.x

- name: Install dependencies
run: pip install -r requirements.txt

# Build full website using main, development and open PRs head branches
# (excluding `development` and `main` as PR head branches)
- name: Build full website
Expand All @@ -103,55 +146,63 @@ jobs:
eval "$command"
done
}

git fetch --all
echo "Build main website"
retry "git checkout main" 5 1 "Failed to checkout 'main'."
retry 'mkdocs build -f mkdocs.yml -d ../website' 5 1 "Failed to build main website."
echo "Build development website"
retry 'git checkout development' 5 1 "Failed to checkout development branch."
retry 'git checkout development' 5 1 "Failed to checkout 'development' branch."
retry 'mkdocs build -f mkdocs.yml -d ../website/development-website' 5 1 "Failed to build development website."
echo "Build PR websites"
command="pr_list=\$(curl -s https://api.github.com/repos/ACCESS-Hive/access-hive.github.io/pulls?state=opened \
| jq '.[] | select(.head.label!=\"ACCESS-Hive:development\" and .head.label!=\"ACCESS-Hive:main\")')"
command="pr_list=\$(curl -s https://api.github.com/repos/${{github.repository}}/pulls?state=opened \
| jq '.[] | select(.head.label!=\"${{ github.repository_owner }}:development\" and .head.label!=\"${{ github.repository_owner }}:main\")')"
retry "$command" 5 1 "Failed to fetch opened PRs."
pr_nums=($(jq '.number' <<< $pr_list))
if [[ -n $pr_nums ]]; then
echo "Found PR numbers: $(sed 's/\s/, /g' <<< ${pr_nums[@]})."
pr_sha=($(jq '.head.sha' <<< $pr_list))
echo "pr_nums=$(sed 's/\s/,/g' <<< [${pr_nums[@]}])" >> "$GITHUB_OUTPUT"
for i in ${!pr_nums[@]}; do
retry "git checkout ${pr_sha[i]}" 5 1 "Failed to checkout git hash ${pr_sha[i]}."
retry "git checkout ${pr_sha[i]}" 5 1 "Failed to checkout git hash '${pr_sha[i]}'."
retry "mkdocs build -f mkdocs.yml -d ../website/pr-preview/pr-${pr_nums[i]}" 5 1 "Failed to build pr-${pr_nums[i]} website."
done
else
echo "No open PR found."
fi
echo "Give the right file permissions"
chmod -c -R +rX ../website

- name: Create artifact for deployment to GitHub Pages
uses: actions/upload-pages-artifact@v2
with:
path: ../website

deploy:
needs: build
runs-on: ubuntu-latest
# Cancel any previous build/deploy jobs that are still running (no need to build/deploy multiple times)
concurrency:
group: build-deploy
cancel-in-progress: true
outputs:
success: ${{ steps.success.outputs.success }}
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source

steps:
- name: Deploy to GitHub Pages
uses: actions/deploy-pages@v2


- name: Output success status
id: success
run: |
echo "success=1" >> "$GITHUB_OUTPUT"

# Set pr-preview URL
pr-preview:
needs: [build,deploy]
needs: [build, deploy]
# If there are open PRs (whose head branch is neither `development` nor `main`), run this job
if: ${{ needs.build.outputs.pr_nums }}
runs-on: ubuntu-latest
Expand All @@ -171,11 +222,81 @@ jobs:
pr_number: ${{ matrix.pr_nums }}
message: "\
PR Preview

:---:

🚀 Deployed preview to
https://access-hive.org.au/pr-preview/pr-${{ matrix.pr_nums }}

https://${{ needs.build.outputs.url }}/pr-preview/pr-${{ matrix.pr_nums }}

${{ env.DATE }}
"
# Add development URL
development-preview:
needs: [build, deploy]
# If there are open PRs (whose head branch is neither `development` nor `main`), run this job
if: ${{ github.event.pull_request.head.ref == 'development' }}
runs-on: ubuntu-latest
steps:
- name: Get date
run: echo "DATE=$(date '+%Y-%m-%d %H:%M %Z')" >> $GITHUB_ENV

- name: Add development-preview URL
if: ${{github.event.action != 'closed'}}
uses: thollander/[email protected]
with:
comment_tag: pr-preview
pr_number: ${{ github.event.number }}
message: "\
Development website preview

:---:

🚀 Development website deployed to
https://${{ needs.build.outputs.url }}/development-website

${{ env.DATE }}
"
"

# Change preview message if deployment fails
failed-preview:
needs: deploy
# If the action failed (but was not cancelled) and was fired because of a pull request (not closed)
if: ${{ always() && '!cancelled()' && github.event_name == 'pull_request' && github.event.action != 'closed' && needs.deploy.outputs.success != '1' }}
runs-on: ubuntu-latest
steps:
- name: Get date
run: echo "DATE=$(date '+%Y-%m-%d %H:%M %Z')" >> $GITHUB_ENV

- name: Change development-preview message
if: ${{ github.event.pull_request.head.ref == 'development' }}
uses: thollander/[email protected]
with:
comment_tag: pr-preview
pr_number: ${{ github.event.number }}
message: "\
Development website preview

:---:

⚠️ There was an error in the deployment of the development website.
For more information, please check the [Actions](https://github.com/${{github.repository}}/actions) tab.

${{ env.DATE }}
"

- name: Change pr-preview message
if: ${{ github.event.pull_request.head.ref != 'development' }}
uses: thollander/[email protected]
with:
comment_tag: pr-preview
pr_number: ${{ github.event.number }}
message: "\
PR preview

:---:

⚠️ There was an error in the pr-preview deployment.
For more information, please check the [Actions](https://github.com/${{github.repository}}/actions) tab.

${{ env.DATE }}
"
35 changes: 0 additions & 35 deletions License.md

This file was deleted.

4 changes: 3 additions & 1 deletion docs/models/run-a-model/run-access-cm.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@
### General prerequisites
Before running {{ model }}, you need to fulfil general prerequisites outlined in the <a href="/getting_started/first_steps">First Steps</a> section.

### <span>Model-specific prerequisites</span>
If you are unsure whether {{ model }} is the right choice for your experiment, take a look at the overview of [ACCESS Models](/models).

### Model-specific prerequisites
<ul>
<li>
<b><i>MOSRS</i> account</i></b>
Expand Down
2 changes: 2 additions & 0 deletions docs/models/run-a-model/run-access-esm.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
### General prerequisites
Before running {{ model }}, you need to fulfil general prerequisites outlined in the [First Steps](/getting_started/first_steps) section.

If you are unsure whether {{ model }} is the right choice for your experiment, take a look at the overview of [ACCESS Models](/models).

### Model-specific prerequisites
<ul>
<li>
Expand Down
3 changes: 3 additions & 0 deletions docs/models/run-a-model/run-access-om.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
## Prerequisites
### General prerequisites
Before running {{ model }}, you need to fulfil general prerequisites outlined in the [First Steps](/getting_started/first_steps) section.

If you are unsure whether {{ model }} is the right choice for your experiment, take a look at the overview of [ACCESS Models](/models).

### Model-specific prerequisites
<ul>
<li>
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ nav:
- Contribute:
- about/contribute/index.md
- Contribute on GitHub: about/contribute/contribute_on_github.md
- License: about/license.md
- License: about/License.md

# Footer
extra:
Expand Down
Loading
Loading