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
- setup-node step
- version step
- cache step
- publish step
  • Loading branch information
asbjornu committed Mar 16, 2021
1 parent 0ceb1c6 commit b0127ef
Showing 1 changed file with 41 additions and 1 deletion.
42 changes: 41 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,56 @@ 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/setup-node@v2
with:
node-version: '12.x'
registry-url: 'https://npm.pkg.github.com'
scope: '@remarkjs'
- 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
if: matrix.os == 'ubuntu-latest'
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npm publish

0 comments on commit b0127ef

Please sign in to comment.