Skip to content

Commit

Permalink
Merge pull request #22 from ai-cfia/issue-20-add-github-pages-deploym…
Browse files Browse the repository at this point in the history
…ent-workflow-to-documentation

Fixes #20: add GitHub pages deployment workflow to documentation
  • Loading branch information
vivalareda authored Nov 22, 2023
2 parents fce944c + cc6939b commit 3d0bae3
Show file tree
Hide file tree
Showing 9 changed files with 76 additions and 77 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/workflow-build-container.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## Reusable Docker Container Build

- **Purpose:** Build and push a Docker image to the Google Artifact Registry (GAR).
- **Usage:** Call this workflow and provide the `container-name` and `tag` as inputs.
- **Required Secrets:**
- `GCP_CLOUDRUN_REGION`: Your Google Cloud Run region.
- `AILAB_GAR_JSON_KEY`: JSON key for authenticating with GAR.
- `AILAB_REGISTRY`: Your GAR registry name.
- `REACT_APP_BACKEND_URL`: Backend URL for the React app.
8 changes: 8 additions & 0 deletions .github/workflows/workflow-deploy-gcp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## Reusable Docker Container Deployment to Google Cloud Run

- **Purpose:** Deploy a Docker container to Google Cloud Run.
- **Usage:** Call this workflow and provide the `container-name` and `tag` as inputs.
- **Required Secrets:**
- `AILAB_GAR_JSON_KEY`: JSON key for authenticating with GAR.
- `GCP_CLOUDRUN_REGION`: Your Google Cloud Run region.
- `AILAB_REGISTRY`: Your GAR registry name.
12 changes: 12 additions & 0 deletions .github/workflows/workflow-gh-pages-deployment.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
## Reusable Build and Deploy to GitHub Pages

- **Purpose:** Build a Node.js project and deploy the static assets to GitHub Pages.
- **Usage:** Call this workflow and provide `node-version`, `publish-dir`, `cache-dependency-path`, `working-dir` (optional, default is root), and `publish-branch` (optional, default is root) as inputs.
- **Required Secrets:**
- `GITHUB_TOKEN`: This token is automatically generated by GitHub to enable push access to the repository.
- **Workflow Steps:**
- **Checkout Repository**: Retrieves the latest code from the specified branch.
- **Setup Node.js Environment**: Configures the Node.js version and sets up caching for npm dependencies.
- **Install Dependencies**: Installs the required npm packages.
- **Build**: Compiles the project into static assets.
- **Deploy to GitHub Pages**: Publishes the static assets to the specified `publish-branch` on GitHub Pages.
1 change: 0 additions & 1 deletion .github/workflows/workflow-gh-pages-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ jobs:
NODE_VERSION: ${{ inputs.node-version }}
PUBLISH_DIR: ${{ inputs.publish-dir }}
CACHE_DEPENDENCY_PATH: ${{ inputs.cache-dependency-path }}
REACT_APP_BACKEND_URL: ${{ secrets.REACT_APP_BACKEND_URL }}
PUBLISH_BRANCH: ${{ inputs.publish-branch }}

steps:
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/workflow-lint-test-node.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## Reusable Lint and Test Workflow for Node (React) Projects

- **Purpose:** Lint and test Node.js (React) projects.
- **Usage:** Call this workflow in your Node.js projects.
- **Note:** Ensure that your project has the necessary scripts for linting and testing in the `package.json` file.
8 changes: 8 additions & 0 deletions .github/workflows/workflow-lint-test-python.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## Reusable Lint and Test Workflow for Python Projects

- **Purpose:** Lint and test Python packages.
- **Usage:** Call this workflow in your Python projects.
- **Required Secrets:**
- `OPENAI_API_KEY`: API key for OpenAI (if utilized in tests).
- `LOUIS_DSN` and `LOUIS_SCHEMA`: Database credentials (if utilized in tests).
- `AZURE_OPENAI_SERVICE`: Azure OpenAI service credentials (if utilized).
4 changes: 4 additions & 0 deletions .github/workflows/workflow-repo-standards-validation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## Reusable Workflow for Standardization Validation

- **Purpose:** Validate the organization's standards across projects.
- **Usage:** Call this workflow while making sure the necessary secrets are inherited for successful execution.
31 changes: 30 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,33 @@ Welcome to the GitHub Workflows repository of AI-CFIA! This repository contains

This repository is dedicated to providing automated solutions and workflows for various operations within our GitHub projects. It contains a collection of reusable workflows for the CI/CD pipelines, testing, and other automated processes within GitHub Actions.

Find out how to use these workflows [here](./github-workflows-documentation.md)
Each workflow has an associated documentation file that explains its purpose, usage, and any required secrets or inputs. You can find these files in the same directory as their corresponding workflow file.

## Workflow Documentation

Here are the available workflows and their associated documentation:

- [Reusable Docker Container Build](.github/workflows/workflow-build-container.md)
- [Reusable Docker Container Deployment to Google Cloud Run](.github/workflows/workflow-deployment-gcr.md)
- [Reusable Lint and Test Workflow for Node (React) Projects](.github/workflows/workflow-lint-test-node.md)
- [Reusable Lint and Test Workflow for Python Projects](.github/workflows/workflow-lint-test-python.md)
- [Reusable Workflow for Standardization Validation](.github/workflows/workflow-standardization-validation.md)
- [Reusable Build and Deploy to GitHub Pages](.github/workflows/workflow-build-deploy-ghpages.md)

## Usage

To use these workflows in your project, you can call them using `workflow_dispatch`. Here’s a basic example of how to call a workflow:

```yaml
name: <Workflow's purpose>

on:
push:
branches: [ main ]

jobs:
my_job:
uses: $OWNER/$REPO/.github/workflows/$WORKFLOW_FILE_NAME.yaml@$BRANCH
secrets: inherit # required if the called workflow you uses secrets
with: # to pass inputs to called workflow
input: value
75 changes: 0 additions & 75 deletions github-workflows-documentation.md

This file was deleted.

0 comments on commit 3d0bae3

Please sign in to comment.