Build and Publish the Library #40
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: Build and Publish the Library | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: Choose a release type | |
required: true | |
type: choice | |
options: | |
- patch | |
- minor | |
- major | |
jobs: | |
build-and-deploy-lib: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: Checkout 🛎️ | |
uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.GH_TOKEN }} | |
- name: Use Node 16 x64 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
architecture: x64 | |
registry-url: "https://registry.npmjs.org" | |
- name: Install and Link 🔗 | |
run: | | |
npm ci | |
npm link | |
npm link @maplibre/maplibre-gl-directions | |
- name: Build 🔧 | |
run: | | |
npm run build | |
- name: Bump Version | |
run: | | |
git config user.name github-actions | |
git config user.email [email protected] | |
npm version ${{ github.event.inputs.version }} --no-git-tag-version --tag-version-prefix=v -m "Update version (${{ github.event.inputs.version }})" | |
git push && git push --tags | |
- name: Get Version | |
id: package-version | |
uses: martinbeentjes/[email protected] | |
- name: Publish to NPM | |
run: | | |
npm publish --access public --non-interactive | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_ORG_TOKEN }} | |
- name: Create Archive | |
run: | | |
zip -r dist dist | |
- name: Create GitHub Release | |
id: create_github_release | |
uses: ncipollo/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag: v${{ steps.package-version.outputs.current-version }} | |
name: v${{ steps.package-version.outputs.current-version }} | |
generateReleaseNotes: true | |
artifacts: "./dist.zip" | |
artifactContentType: "application/zip" |