Merge pull request #47 from deven-org/chore/update-dependencies #52
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: "Release & Publish" | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
env: | |
NODE_VERSION: "16" | |
permissions: | |
contents: write | |
pull-requests: write | |
packages: write | |
jobs: | |
Build-and-Release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
- name: Setup node environment | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{env.NODE_VERSION}} | |
cache: npm | |
registry-url: https://npm.pkg.github.com/ | |
- name: Cache dependencies | |
id: cache | |
uses: actions/cache@v3 | |
with: | |
path: ./node_modules | |
key: modules-${{ hashFiles('package-lock.json') }} | |
- name: Install Dependencies | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: npm ci | |
- name: Run test | |
run: npm run test:coverage | |
- name: Create new release | |
uses: google-github-actions/release-please-action@v3 | |
id: release | |
with: | |
release-type: node | |
package-name: "@deven-org/documentation-skeleton" | |
token: ${{secrets.GITHUB_TOKEN}} | |
- name: NPM Publish | |
run: npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
if: ${{ steps.release.outputs.release_created }} | |
- name: Notify new release to Slack | |
id: slack | |
uses: slackapi/slack-github-action@v1.23.0 | |
with: | |
payload: | | |
{ | |
"package": "@deven-org/documentation-skeleton", | |
"status": "${{ job.status }}", | |
"head_commit": "${{github.event.head_commit.url }}", | |
"pr_url": "${{ github.event.pull_request.html_url || github.event.head_commit.url }}", | |
"release_created": "${{ steps.release.outputs.release_created }}", | |
"major": "${{ steps.release.outputs.major }}", | |
"minor": "${{ steps.release.outputs.minor }}", | |
"patch": "${{ steps.release.outputs.patch }}" | |
} | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
if: ${{ steps.release.outputs.release_created }} |