Skip to content

Commit

Permalink
Merge branch 'main' into hello-world
Browse files Browse the repository at this point in the history
  • Loading branch information
SKairinos committed Jul 24, 2023
2 parents ae0873c + 5ba58fa commit 4ead018
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 22 deletions.
32 changes: 23 additions & 9 deletions .github/workflows/javascript-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@ name: Node.js Package

on:
push:
branches: ["main"]
paths-ignore:
- "README.md"
- "CHANGELOG.md"

jobs:
test:
name: Test Code
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -25,6 +23,7 @@ jobs:
with:
node-version: ${{ matrix.node }}

# TODO: cache node packages
- name: Install Node Packages
run: npm install

Expand All @@ -35,16 +34,11 @@ jobs:
# - name: Test Code
# run: npm run test -- --watchAll=false

release:
name: Publish Release
build:
needs: [test]
concurrency: release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
fetch-depth: 0

- uses: actions/setup-node@v3
with:
Expand All @@ -55,12 +49,13 @@ jobs:
git config --local user.name github-actions
git config --local user.email [email protected]
# TODO: cache node packages
- name: Install Node Packages
run: npm install --only=dev

- name: Build Package
run: npm run build

- name: Push Build Files
run: |
git add lib/*
Expand All @@ -69,6 +64,25 @@ jobs:
git push
fi
release:
needs: [test, build]
concurrency: release
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
fetch-depth: 0

- uses: actions/setup-node@v3
with:
node-version: 19.7

# TODO: group release dependencies
- name: Install Node Packages
run: npm install --only=dev

- name: Publish Semantic Release
env:
GH_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
Expand Down
57 changes: 44 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# codeforlife-package-javascript

This repo hosts Code for Life's Node.js package. This package contains all reusable frontend code, meant to be installed across CFL's various frontend services.
This repo hosts Code for Life's Node.js package. This package contains all
reusable frontend code, meant to be installed across CFL's various frontend
services.

## Installation

To install this package, do one of the following options.

*Remember to replace the version number ("0.0.0") with your [desired version](https://github.com/ocadotechnology/codeforlife-package-javascript/releases).*

Note that the version property in `package.json` is not set as it's only needed when publishing to NPM.
*Remember to replace the version number ("0.0.0") with your
[desired version](https://github.com/ocadotechnology/codeforlife-package-javascript/releases).*

**Option 1:** Run `yarn install` command:

Expand All @@ -26,19 +27,49 @@ yarn install git+https://github.com/ocadotechnology/codeforlife-package-javascri
}
```

**Why does Yarn install an old version of the CFL package?**
## Making Changes

This sometimes occurs because Yarn has cached an old version of the CFL package. To resolve this, clear your cache and then install the new version.
To make changes, you must:

```bash
yarn cache clean
1. Branch off of main.
1. Push your changes on your branch.
1. Ensure the pipeline runs successfully on your branch.
1. Have your changes reviewed and approved by a peer.
1. Merge your branch into the main branch.

### Installing your branch

You may wish to install and integrate your changes into a CFL frontend before
it's been peer-reviewed.

*Remember to replace the branch name ("my-branch") with your
[branch](https://github.com/ocadotechnology/codeforlife-package-javascript/branches)*.

```json
{
"dependencies": {
"codeforlife": "github:ocadotechnology/codeforlife-package-javascript#my-branch"
}
}
```

## Pipeline

The pipeline for this repo will automatically run the following steps when a push is made to the `main` branch.
When pushing to any branch, the pipeline will:

1. Check the code for linting errors.
1. Run tests on the React components.
1. Build the package.
1. Save the build to the `lib` directory.

When merging to the `main` branch, the pipeline will:

1. Setup a node env and install dependencies.
1. Assert that there are no lint or test errors.
1. Build the package, outputted to the `lib` directory.
1. Push changes to `lib`, `CHANGELOG.md` and create a new GitHub Release.
1. Update the package version in
[package.json](https://github.com/ocadotechnology/codeforlife-package-javascript/blob/main/package.json).
1. Update
[CHANGELOG.md](https://github.com/ocadotechnology/codeforlife-package-javascript/blob/main/CHANGELOG.md)
with latest commit messages.
1. Determine the next version number from the commit messages using
[semantic versioning](https://semver.org/).
1. Release a new version
[on GitHub](https://github.com/ocadotechnology/codeforlife-package-javascript/releases).

0 comments on commit 4ead018

Please sign in to comment.