Skip to content

Commit

Permalink
Add build and publish scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
gdman committed Mar 15, 2021
1 parent d1f8054 commit d174188
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Build and Test

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build-and-test:

runs-on: ${{ matrix.os }}

strategy:
matrix:
node-version: [10.x, 12.x, 14.x, 15.x]
os: [ubuntu-latest, windows-latest, macOS-latest]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm test
56 changes: 56 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Publish

on:
workflow_dispatch:
inputs:
version:
description: 'New version'
default: 'patch'
required: true

jobs:

publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Increment Version, Test and Pack
run: |
git config --global user.email "[email protected]"
git config --global user.name "Version Bot"
npm version ${{ github.event.inputs.version }}
echo version=`jq -r .version package.json` >> $GITHUB_ENV
npm ci
npm test
npm pack
- name: Create Release
uses: actions/create-release@v1
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ env.version }}
release_name: v${{ env.version }}
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./sf-metadata-${{ env.version }}.tgz
asset_name: sf-metadata-${{ env.version }}.tgz
asset_content_type: application/tgz
- uses: actions/setup-node@v1
with:
node-version: 12
registry-url: https://registry.npmjs.org/
- name: Publish
run: npm publish ./sf-metadata-${{ env.version }}.tgz
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}

0 comments on commit d174188

Please sign in to comment.