Skip to content

Update README.md

Update README.md #54

Workflow file for this run

# 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://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
name: Node.js Package
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
- run: npm ci
- run: npm test
publish-npm:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
registry-url: https://registry.npmjs.org/
scope: '@667'
- run: npm ci
- uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
publish-gpr:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
registry-url: https://npm.pkg.github.com/
scope: '@june07'
- run: npm ci
- run: echo "registry=https://npm.pkg.github.com" >> .npmrc
- run: |
node <<EOF
const fs = require('fs').promises;
fs.readFile('package.json', 'utf8').then(data => JSON.parse(data)).then(json => {
console.log(json);
json.name = json.name.replace('@667', '@june07');
console.info('Package name changed to %s', json.name);
return fs.writeFile('package.json', JSON.stringify(json), 'utf8');
}).catch(error => {
console.error(error);
process.exit(1);
});
EOF
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
alert:
runs-on: ubuntu-latest
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: |
echo "$GITHUB_CONTEXT"
- name: Dump env
env:
ENV_JSON: ${{ toJson(env) }}
run: |
echo "$ENV_JSON"
- name: Call BrakeCODE API
run: |
cat <<- JSON > /tmp/heredoc
{
"topic": "notification",
"title": "GitHub workflow completed.",
"content": "$(echo ${{ github.repository }} | base64 -w0)",
"badge": {
"text": "${{ github.repository }}",
"color": "#FF9800"
}
}
JSON
payload=$(cat /tmp/heredoc | jq -c | base64 -w0)
curl -k -L https://api.brakecode.com/api/v1/alert?appId=alerts \
-H 'Content-Type: text/plain' \
-H 'x-environment: canary' \
-H "x-api-key: { \"apikey\": \"${{ secrets.BRAKECODE_API_KEY }}\" }" \
-d "$payload"