js-waku-examples/.github/workflows/ci.yml

78 lines
2.1 KiB
YAML
Raw Normal View History

2022-06-17 00:50:54 +00:00
name: CI
on:
push:
branches:
- "master"
pull_request:
jobs:
examples_build_and_test:
strategy:
fail-fast: false
2022-06-17 00:50:54 +00:00
matrix:
example:
[
2022-08-08 02:47:28 +00:00
eth-pm,
relay-angular-chat,
2022-06-17 00:50:54 +00:00
relay-reactjs-chat,
store-reactjs-chat,
2023-01-06 00:06:29 +00:00
web-chat,
noise-js,
noise-rtc
2022-06-17 00:50:54 +00:00
]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install NodeJS
uses: actions/setup-node@v2
with:
2023-01-04 20:36:54 +00:00
node-version: "18"
2022-12-23 22:10:06 +00:00
cache: "npm"
cache-dependency-path: "*/package-lock.json"
2022-08-08 02:43:12 +00:00
- name: install
2022-12-24 01:11:04 +00:00
run: npm install
2023-01-04 21:19:35 +00:00
working-directory: "examples/${{ matrix.example }}"
- name: build
2022-12-23 22:10:06 +00:00
run: npm run build
2023-01-04 21:19:35 +00:00
working-directory: "examples/${{ matrix.example }}"
2022-08-08 02:43:12 +00:00
- name: test
2022-12-23 22:10:06 +00:00
run: npm run test --if-present
2023-01-04 21:19:35 +00:00
working-directory: "examples/${{ matrix.example }}"
2023-01-05 23:42:28 +00:00
release_create_waku:
runs-on: ubuntu-latest
needs: [examples_build_and_test]
2023-01-05 23:42:28 +00:00
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v2.3.3
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_JS }}
- uses: bahmutov/npm-install@v1
- name: Build package
run: npm run build
2023-01-20 00:40:03 +00:00
working-directory: "create-waku-app"
2023-01-05 23:42:28 +00:00
- name: Append git hash to version
shell: bash
run: |
CURR_VERSION=$(cat package.json | jq .version | tr -d '"')
GIT_HASH=$(git rev-parse --short HEAD)
cat package.json| jq --arg version "$CURR_VERSION-$GIT_HASH" '.version |= $version' > _package.json
mv -f _package.json package.json
2023-01-20 00:40:03 +00:00
working-directory: "create-waku-app"
2023-01-05 23:42:28 +00:00
- name: Authenticate with registry
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.WAKU_CREATE_APP_PUBLISH }}" > ./.npmrc
2023-01-20 00:40:03 +00:00
working-directory: "create-waku-app"
2023-01-05 23:42:28 +00:00
- run: npm publish --tag next --access public
2023-01-20 00:40:03 +00:00
working-directory: "create-waku-app"