Skip to content

Commit

Permalink
adds publish job
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewMacmurray committed Sep 13, 2023
1 parent b92b99a commit f4d6aa5
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 1 deletion.
36 changes: 36 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Publish

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/cache@v3
with:
path: |
~/.elm
~/.npm
**/elm-stuff
**/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- run: npm run check-versions
- run: npm install
- uses: dillonkearns/elm-publish-action@v1
id: elm-package-publish
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-elm: ./node_modules/.bin/elm
- if: steps.elm-package-publish.outputs.is-publishable == 'true'
run: npm run runner:compile
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -384,3 +384,10 @@ View the docs locally with:
```
npm run docs
```

## Publishing a new release

1. Run `elm bump` to bump the elm version.
2. Update the `version` in [package.json](./package.json) to match the new elm version.
3. Commit and push the updates.
4. Wait for the [Publish Github Action](./.github/workflows/publish.yml) to complete.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"review": "elm-review --fix",
"review:ci": "elm-review",
"review:watch": "elm-review --watch",
"runner:compile": "tsc"
"runner:compile": "tsc",
"check-versions": "node ./scripts/versions.js"
},
"author": "Andrew MacMurray",
"license": "MIT",
Expand Down
13 changes: 13 additions & 0 deletions scripts/versions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const packageJson = require("../package.json");
const elmJson = require("../elm.json");

check();

function check() {
if (packageJson.version === elmJson.version) {
process.exit(0);
} else {
console.error("ERROR: elm and npm package versions do not match.");
process.exit(1);
}
}

0 comments on commit f4d6aa5

Please sign in to comment.