Skip to content

Refactoring CI workflows #163

Refactoring CI workflows

Refactoring CI workflows #163

Workflow file for this run

name: Deploy PR previews
on:
pull_request:
types:
- opened
- reopened
- synchronize
- closed
workflow_run:
workflows: ["CI"]
types:
- completed
# https://docs.github.com/en/actions/using-jobs/using-concurrency
concurrency:
# only cancel in-progress jobs or runs for the current workflow - matches against branch & tags
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
deploy-preview:
runs-on: ubuntu-latest
strategy:
fail-fast: false
timeout-minutes: 60
env:
COMMIT_AUTHOR: Deploy Action
COMMIT_AUTHOR_EMAIL: action@github.com
VITE_PR_PREVIEW_PATH: "/aiida-registry/pr-preview/pr-${{ github.event.number }}/"
steps:
- name: Checkout Repo ⚡️
uses: actions/checkout@v3
- name: Create dev environment
uses: ./.github/actions/create-dev-env
- name: fetch metadata
if: steps.cache-plugins-restore.outputs.cache-hit != 'true'
id: fetch_metadata
env:
# Use the GITHUB_TOKEN for github API calls
# otherwise the rate limit will be exceeded
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: aiida-registry fetch
- name: Check plugins installation
# This step will attach plugin installation inforamtion to the metadata, e.g. if the plugin can be installed or not
run: aiida-registry test-install
- name: Move JSON file to the React project
run: |
cp plugins_metadata.json aiida-registry-app/src/
cp plugins_metadata.json aiida-registry-app/dist/
- uses: actions/setup-node@v3
with:
node-version: '18.x'
- name: Install npm dependencies and build
run: |
echo $VITE_PR_PREVIEW_PATH
npm install
npm run build
working-directory: ./aiida-registry-app
- name: Deploy preview
uses: rossjrw/pr-preview-action@v1
with:
source-dir: ./aiida-registry-app/dist
preview-branch: gh-pages
umbrella-dir: pr-preview
action: auto
custom-url: