Skip to content

Commit

Permalink
Add publish step to the GitHub Actions workflow
Browse files Browse the repository at this point in the history
Modify the GitHub Actions workflow by adding:

- gitversion job
- version step
- cache step
- publish step
  • Loading branch information
asbjornu committed Mar 16, 2021
1 parent 0ceb1c6 commit cf73e1e
Showing 1 changed file with 37 additions and 1 deletion.
38 changes: 37 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,52 @@ name: build
on: [push, pull_request]

jobs:
gitversion:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.gitversion.outputs.fullSemVer }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: gittools/actions/gitversion/setup@v0.9.7
with:
versionSpec: '5.x'
- uses: gittools/actions/gitversion/execute@v0.9.7
id: gitversion

build:
needs: gitversion
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
env:
cache-name: cache-npm
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-build-${{ env.cache-name }}-
- name: update package.json version
if: matrix.os != 'windows-latest'
run: cat <<< $(jq '.version = "${{ needs.gitversion.outputs.version }}"' package.json) > package.json
- run: npm install
- run: npm run build
- name: run headless test
- uses: actions/upload-artifact@v2
if: matrix.os == 'ubuntu-latest'
with:
name: vscode-remark
path: out
- name: test
uses: GabrielBB/xvfb-action@v1.4
with:
run: npm test
- name: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "registry=https://npm.pkg.github.com/remarkjs" > .npmrc
npm publish

0 comments on commit cf73e1e

Please sign in to comment.