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

add catalog preview concept #2

Merged
merged 2 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
17 changes: 8 additions & 9 deletions .github/workflows/build_main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,16 @@ jobs:
permissions:
contents: write
pages: write
pull-requests: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python 3.10
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.12"
- name: Install dependencies
run: |
pip install -U pip
Expand All @@ -38,11 +39,9 @@ jobs:
SH_CLIENT_SECRET: ${{ secrets.SH_CLIENT_SECRET }}
run: eodash_catalog
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
if: github.ref == 'refs/heads/main'
uses: JamesIves/github-pages-deploy-action@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build
force_orphan: true


folder: ./build
branch: gh-pages
clean-exclude: pr-preview
force: false
55 changes: 55 additions & 0 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# .github/workflows/preview.yml
# This is a basic workflow takes care of building and deploying
# catalog when creating merge request

name: Deploy PR previews

on:
pull_request:
types:
- opened
- reopened
- synchronize
- closed # pr-preview-action will do cleanup here, but build steps can be skipped

# do not allow running multiple of pipelines for this PR in parallel
concurrency: preview-${{ github.ref }}

jobs:
deploy-preview:
runs-on: ubuntu-22.04
permissions:
contents: write
pages: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- if: github.event.action != 'closed'
name: Install dependencies
run: |
pip install -U pip
pip install -r requirements.txt
- if: github.event.action != 'closed' && (github.event.pull_request.body == 'all' || github.event.pull_request.body == '')
name: Build all collections
env:
SH_INSTANCE_ID: ${{ secrets.SH_INSTANCE_ID }}
SH_CLIENT_ID: ${{ secrets.SH_CLIENT_ID }}
SH_CLIENT_SECRET: ${{ secrets.SH_CLIENT_SECRET }}
run: eodash_catalog
- if: github.event.action != 'closed' && (github.event.pull_request.body != 'all' && github.event.pull_request.body != '')
name: Build only specified collections from PR comment text
env:
SH_INSTANCE_ID: ${{ secrets.SH_INSTANCE_ID }}
SH_CLIENT_ID: ${{ secrets.SH_CLIENT_ID }}
SH_CLIENT_SECRET: ${{ secrets.SH_CLIENT_SECRET }}
run: |
eodash_catalog ${{ github.event.pull_request.body }}
- name: Deploy preview
uses: rossjrw/pr-preview-action@v1
with:
source-dir: ./build
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# catalog-template
Template for creating eodash catalog repository
Template for creating eodash catalog repository.

## How-to
You can create a new repository using the "use this template" button.
Expand Down