Main #113
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created | |
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages | |
name: Main | |
on: | |
push: | |
paths-ignore: | |
- "README.md" | |
- "CHANGELOG.md" | |
- "lib/**" # TODO: remove lib folder | |
workflow_dispatch: | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node: [19.7] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Node ${{ matrix.node }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node }} | |
# TODO: cache node packages | |
- name: Install Node Packages | |
run: npm install | |
- name: Check Code Format | |
run: npm run lint | |
# TODO: https://www.pluralsight.com/guides/how-to-test-react-components-in-typescript | |
# - name: Test Code | |
# run: npm run test -- --watchAll=false | |
# TODO: remove this job | |
build: | |
needs: [test] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 19.7 | |
- name: Setup Git | |
run: | | |
git config --local user.name cfl-bot | |
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/* | |
if ! git diff --staged --quiet; then | |
git commit -m "push build files" | |
git push | |
fi | |
release: | |
needs: [build] | |
concurrency: release | |
runs-on: ubuntu-latest | |
if: github.ref_name == 'main' | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
fetch-depth: 0 | |
- name: Pull Build Files | |
run: git pull | |
- 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 }} | |
GIT_AUTHOR_NAME: cfl-bot | |
GIT_AUTHOR_EMAIL: [email protected] | |
GIT_COMMITTER_NAME: cfl-bot | |
GIT_COMMITTER_EMAIL: [email protected] | |
run: npx semantic-release |