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

Test workflows 2 #599

Closed
wants to merge 15 commits into from
66 changes: 12 additions & 54 deletions .github/workflows/build_preview.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build PR preview
name: PR preview

on:
pull_request:
Expand All @@ -13,83 +13,41 @@ concurrency:
cancel-in-progress: true

jobs:
build-preview:
if: github.event.action != "closed"
build-and-deploy-preview:
if: ${{ github.event.action != 'closed' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

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

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

- name: Build
# builds to "site" directory by default
run: |
mkdocs build -f mkdocs.yml -d site
- name: Build preview website
run: mkdocs build -f mkdocs.yml -d pr_preview-${{ github.ref }}

- name: Save built site
run: |
mkdir -p ./pr_site
mv site ./pr_site/.

- uses: actions/upload-artifact@v3
with:
name: pr_site
path: pr_site/

deploy-preview:
needs: build-preview
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- uses: actions/setup-python@v4
with:
python-version: 3.x

- name: "Download built site"
uses: actions/[email protected]
with:
script: |
var artifacts = await github.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{github.event.workflow_run.id }},
});
var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == "pr_site"
})[0];
var download = await github.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
var fs = require('fs');
fs.writeFileSync('${{github.workspace}}/pr_site.zip', Buffer.from(download.data));
- run: unzip pr_site.zip

- name: Deploy preview
uses: access-nri/[email protected]
with:
source-dir: site
source-dir: pr_preview-${{ github.ref }}
action: deploy
pr-number: ${{ github.event.number }}

close-preview:
if: github.event.action == 'closed'
if: ${{ github.event.action == 'closed' }}
runs-on: ubuntu-latest
steps:

- name: Checkout
uses: actions/checkout@v3
- uses: actions/setup-python@v4

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

Expand Down
1 change: 0 additions & 1 deletion .github/workflows/mlc_config.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
:w
{
"ignorePatterns": [
{
Expand Down
24 changes: 8 additions & 16 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,7 @@ on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

permissions:
actions: write
checks: write
contents: write
deployments: write
issues: write
packages: write
pull-requests: write
pages: write
repository-projects: write
security-events: write
statuses: write
id-token: write
permissions: write-all

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
Expand All @@ -34,15 +22,16 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

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

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

- name: Build
run: |
mkdocs build -f mkdocs.yml -d site
run: mkdocs build -f mkdocs.yml -d site

- name: Deploy to gh-pages
uses: JamesIves/github-pages-deploy-action@v4
Expand All @@ -62,13 +51,16 @@ jobs:
uses: actions/checkout@v3
with:
ref: 'gh-pages'

- name: Setup Pages
uses: actions/configure-pages@v3

- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
# Upload entire repository
path: '.'

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
[![ACCESS-Hive Badge](docs/assets/badge.svg)](https://access-hive.org.au/)
[![github-contributors](https://img.shields.io/github/contributors/ACCESS-Hive/access-hive.github.io?color=blue&style=plastic)][github-repo]
[![forum-users](https://img.shields.io/discourse/users?color=blue&label=forum&server=https%3A%2F%2Fforum.access-hive.org.au&style=plastic)][forum]
[![Link Check](https://github.com/ACCESS-Hive/access-hive.github.io/actions/workflows/scheduled_link_check.yml/badge.svg)](https://github.com/ACCESS-Hive/access-hive.github.io/actions/workflows/scheduled_link_check.yml)
[![Link Check](https://github.com/ACCESS-Hive/access-hive.github.io/actions/workflows/check_links.yml/badge.svg)](https://github.com/ACCESS-Hive/access-hive.github.io/actions/workflows/check_links.yml)

Documentation hub for the Earth System models, ACCESS, and their community.

Expand All @@ -12,7 +12,7 @@ https://access-hive.org.au/

If you wish to add documentation to the ACCESS-Hive website see the [contribution guide](https://access-hive.org.au/about/contribute/) for instructions.

# How to Contribute [Draft]
<!-- # How to Contribute [Draft]

- Pull the latest version of `development` branch locally by using the following commands:

Expand Down Expand Up @@ -54,7 +54,7 @@ If you wish to add documentation to the ACCESS-Hive website see the [contributio

![Screenshot 2023-06-02 at 2 05 13 pm](https://github.com/ACCESS-Hive/access-hive.github.io/assets/42607679/ec141fc9-ee00-4a84-ae5a-081761400765)

- When creating a pull request (PR) please also assign a reviewer to avoid delays. For technical content please assign an expert reviewer.
- When creating a pull request (PR) please also assign a reviewer to avoid delays. For technical content please assign an expert reviewer. -->

# License
The ACCESS-Hive site is covered by [the CC-BY 4.0 license][License].
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ hide:
<h1 class="homepage"></h1>
<div class="introduction">
<div>
<div>Welcome to ACCESS-Hive!</div>
<div>Welcome to ACCESS-Hive test2!</div>
<div>The open portal for the ACCESS user community, hosted by <a href="https://www.access-nri.org.au/" target="_blank">ACCESS-NRI</a></div>
</div>
<div>
Expand Down