Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: automate changelog generation #44

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 41 additions & 46 deletions .github/workflows/npm-publish.yml → .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,63 +1,57 @@
name: Build @cryptlex/lexactivator package
name: release

on:
workflow_dispatch:
inputs:
libraryVersion:
description: 'Library Version'
required: true
default: ''
packageVersion:
description: 'Package Version'
required: true
default: ''
push:
branches:
- master

jobs:
# Set version in package.json, git tag
update-version:
# Create release PR
release-please:
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release.outputs.release_created }}
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Update Library Version
run: |
sed -i '/VERSION=/!b;cVERSION=\"v${{ github.event.inputs.libraryVersion }}";' scripts/*.sh
sed -i '/lexactivator_version =/!b;c$lexactivator_version ="v${{ github.event.inputs.libraryVersion }}"' scripts/*.ps1
- uses: google-github-actions/release-please-action@v3
id: release
with:
release-type: node
package-name: lexactivator-js
changelog-types: '[{"type":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false},{"type":"chore","section":"Miscellaneous","hidden":false}]'

- name: Update Package Version
run: |
sed -i '/"version":/!b;c \ \ "version": "${{ github.event.inputs.packageVersion }}",' package.json

- name: Commit, Tag and Push
# Get latest LexActivator
lexactivator-latest:
uses: cryptlex/action-workflows/.github/workflows/lexactivator-latest-version.yml@main
needs: release-please
if: ${{ needs.release-please.outputs.release_created }}

# Update scripts to use latest LexActivator version
update-scripts:
runs-on: ubuntu-latest
needs: [release-please, lexactivator-latest]
if: ${{ needs.release-please.outputs.release_created }}
steps:
- uses: actions/checkout@v3
- name: Update Library Version
run: |
git add package.json
git add scripts/*.*
git config user.name github-actions
git config user.email github-actions@github.com
git commit -m "chore(package version): updated version" | exit 0
git tag ${{ github.event.inputs.packageVersion }}
git push & git push --tags
sed -i '/VERSION=/!b;cVERSION=\"v${{ needs.lexactivator-latest.outputs.version }}";' scripts/*.sh
sed -i '/lexactivator_version =/!b;c$lexactivator_version ="v${{ needs.lexactivator-latest.outputs.version }}"' scripts/*.ps1

# Link LexActivator static libs to Node
build-addons:
needs: update-version
needs: [release-please, lexactivator-latest, update-scripts]
if: ${{ needs.release-please.outputs.release_created }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-2019]
steps:
- uses: actions/checkout@v2

- uses: actions/checkout@v3
- run: git pull origin master --ff-only

- uses: actions/setup-node@v1
- uses: actions/setup-node@v3
with:
node-version: 10

# - name: Install Windows 2015 build tools
# if: matrix.os == 'windows-2019'
# run: npm i --global windows-build-tools --vs2015
node-version: 12

- name: Build for Windows
if: matrix.os == 'windows-2019'
Expand Down Expand Up @@ -89,16 +83,17 @@ jobs:
./lib/bindings/windows/**/*.node
./lib/bindings/windows/**/*.dll
retention-days: 1

# Publish to NPM
publish-npm:
needs: build-addons
needs: [release-please, lexactivator-latest, update-scripts, build-addons]
if: ${{ needs.release-please.outputs.release_created }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 12
registry-url: https://registry.npmjs.org/
- run: git pull origin master --ff-only

Expand All @@ -115,4 +110,4 @@ jobs:

- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx --no -- commitlint --edit ${1}
Empty file added CHANGELOG.md
Empty file.
1 change: 1 addition & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = {extends: ['@commitlint/config-conventional']}
Loading