Skip to content

Remove reqore, use generics instead #375

Remove reqore, use generics instead

Remove reqore, use generics instead #375

Workflow file for this run

name: Tests
on:
pull_request:
branches:
- develop
jobs:
tests:
runs-on: ubuntu-latest
steps:
# Get time of PR event trigger
- name: Get current time
uses: josStorer/[email protected]
id: current_time
with:
format: YYYYMMDD-HH
utcOffset: '+01:00'
# Checkout repository
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
# Get head commit message
- name: Print head git commit message
id: get_head_commit_message
run: echo "::set-output name=HEAD_COMMIT_MESSAGE::$(git show -s --format=%s)"
# Setup git user
- name: Setup git user
run: |
# setup the username and email. I tend to use 'GitHub Actions Bot' with no email by default
git config user.name "GitHub Actions Bot"
git config user.email "<>"
# Setup node
- uses: actions/setup-node@v3
with:
node-version: latest
# Install modules
- name: Installing modules
id: install_modules
run: |
rm -rf node_modules
yarn install
# Save release version
- name: Save release version to outputs
id: save_release_version
run: echo ::set-output name=version::$(node -pe "require('./pullRequestRelease.json').version")
# Run Unit Tests
- name: Running tests
env:
ENDPOINT_API: ${{ secrets.ENDPOINT_API}}
API_USER_NAME: ${{ secrets.API_USER_NAME}}
API_USER_PASS: ${{ secrets.API_USER_PASS }}
id: tests
run: yarn run test
# Test the build
- name: Build test
env:
ENDPOINT_API: ${{ secrets.ENDPOINT_API}}
API_USER_NAME: ${{ secrets.API_USER_NAME}}
API_USER_PASS: ${{ secrets.API_USER_PASS }}
id: build_test
run: yarn run build:test
# Build storybook documentation
- name: Build documentation JSON
id: build_docs_json
run: yarn docs
# Publish documentation to chromatic
- name: Publish to Chromatic
env:
ENDPOINT_API: ${{ secrets.ENDPOINT_API}}
API_USER_NAME: ${{ secrets.API_USER_NAME}}
API_USER_PASS: ${{ secrets.API_USER_PASS }}
id: chromatic_publish
uses: chromaui/action@latest
with:
token: ${{ secrets.GITHUB_TOKEN }}
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
exitZeroOnChanges: true
# Change package version to make release
- name: Change npm version
id: change_npm_version
run: npm version ${{ steps.save_release_version.outputs.version }} --no-git-tag-version --force
# Publish new release to NPM
- name: Publish to NPM
id: npm_publish
uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
tag: pull_request_${{ steps.save_release_version.outputs.version }}
access: public
# Notify discord if all steps succeeded
- name: Discord notification
env:
DISCORD_WEBHOOK: ${{secrets.DISCORD_WEBHOOK}}
DISCORD_EMBEDS: '[{ "author": { "icon_url": "https://avatars.githubusercontent.com/${{ github.actor }}", "name": "${{ github.actor }}", "url": "https://github.com/${{github.actor}}" },"url": "https://github.com/${{github.repository}}/commit/${{github.sha}}","fields": [{ "name": "Commit Message", "value": "${{ steps.get_head_commit_message.outputs.HEAD_COMMIT_MESSAGE }}"},{ "name": "Repository", "value": "[${{github.event.repository.name}}](${{github.event.repository.clone_url}})", "inline": true },{ "name": "Branch", "value": "[${{github.ref_name}}](https://github.com/${{github.repository}}/pull/${{github.ref_name}})", "inline": true },{ "name": "Event", "value": "${{github.event_name}}", "inline": true },{ "name": "Author", "value": "[${{github.actor}}](https://github.com/${{github.actor}})", "inline": true },{ "name": "Job", "value": "${{github.job}}", "inline": true},{ "name": "", "value": "🤖 [Github Action](https://github.com/${{ github.repository}}/actions/runs/${{ github.run_id}}) 📙 [Documentation](${{ steps.chromatic_publish.outputs.storybookUrl }}) 🎨 [Chromatic Tests](${{ steps.chromatic_publish.outputs.buildUrl }})"}],"color":65280,"footer":{"text": "Published at ${{steps.current_time.outputs.readableTime}}"}}]'
DISCORD_AVATAR: 'https://raw.githubusercontent.com/qoretechnologies/qorus-toolkit/7d7988ad2be4388b1371f684278102d76f9ca5cb/public/q-symbol-small.png'
uses: Ilshidur/[email protected]
with:
args: ':white_check_mark: Release *v${{ steps.save_release_version.outputs.version }}* successfully created & published!'
if: success()
# Notify discord if all steps failed
- name: Discord notification
env:
DISCORD_WEBHOOK: ${{secrets.DISCORD_WEBHOOK}}
DISCORD_EMBEDS: '[{ "author": { "icon_url": "https://avatars.githubusercontent.com/${{ github.actor }}", "name": "${{ github.actor }}", "url": "https://github.com/${{github.actor}}" },"url": "https://github.com/${{github.repository}}/commit/${{github.sha}}","fields": [{ "name": "Commit Message", "value": "${{ steps.get_head_commit_message.outputs.HEAD_COMMIT_MESSAGE }}"},{ "name": "Repository", "value": "[${{github.event.repository.name}}](${{github.event.repository.clone_url}})", "inline": true },{ "name": "Branch", "value": "[${{github.ref_name}}](https://github.com/${{github.repository}}/pull/${{github.ref_name}})", "inline": true },{ "name": "Event", "value": "${{github.event_name}}", "inline": true },{ "name": "Author", "value": "[${{github.actor}}](https://github.com/${{github.actor}})", "inline": true },{ "name": "Job", "value": "${{github.job}}", "inline": true },{ "name": "", "value": "🤖 [Github Action](https://github.com/${{ github.repository}}/actions/runs/${{ github.run_id}})"}],"color":16711680,"footer":{"text": "Published at ${{steps.current_time.outputs.readableTime}}"}}]'
DISCORD_AVATAR: 'https://raw.githubusercontent.com/qoretechnologies/qorus-toolkit/7d7988ad2be4388b1371f684278102d76f9ca5cb/public/q-symbol-small.png'
uses: Ilshidur/[email protected]
with:
args: ':exclamation: Release *v${{ steps.save_release_version.outputs.version }}* failed!'
if: failure()