Add missing token on Github Actions workflows #16
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
name: CI | |
# test, build documentation and publish | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
publish: | |
permissions: | |
contents: read | |
packages: read | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
- uses: webfactory/[email protected] | |
with: | |
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
# Install dependencies | |
- run: npm ci --verbose | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# Run tests and publish code coverage badge | |
- run: npm run test:json | |
- name: "Combine" | |
run: | | |
export TOTAL=$(cat coverage/coverage-summary.json | jq .total.statements.pct) | |
echo "total=$TOTAL" >> $GITHUB_ENV | |
echo "### Total coverage: ${TOTAL}%" >> $GITHUB_STEP_SUMMARY | |
- name: Dynamic Badges | |
uses: Schneegans/[email protected] | |
with: | |
auth: ${{ secrets.GIST_SECRET }} | |
filename: ${{ github.event.repository.name }}.json | |
gistID: 27d772a9a3a8a945b34fd9676de40486 | |
label: Coverage | |
minColorRange: 50 | |
message: ${{ env.total }}% | |
maxColorRange: 90 | |
namedLogo: Jest | |
valColorRange: ${{ env.total }} | |
# Publish docs | |
- run: npm run docs | |
- uses: cpina/[email protected] | |
env: | |
SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }} | |
with: | |
destination-github-username: Mafalda-SFU | |
destination-repository-name: Mafalda-SFU.github.io | |
source-directory: docs | |
target-directory: docs/${{ github.event.repository.name }} | |
user-email: [email protected] | |
user-name: Mafalda bot | |
# TODO: add steps to update the version using semantic-release, and | |
# publish to Github Packages and NPM |