Skip to content

Commit

Permalink
Refactor GH Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
vladimirlogachev committed May 2, 2024
1 parent 2f867b5 commit a18716d
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 13 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/publish-elm-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Publish Elm package

on:
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: false

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
45 changes: 45 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Pull request (check, build)

on:
pull_request:
types:
- opened
# "synchronize" means new commits pushed to the HEAD of the pull request branch
- synchronize

permissions:
contents: read
pages: write
id-token: write


concurrency:
group: "pages"
cancel-in-progress: false

jobs:
check-and-build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 20.12

- name: Install dependencies
run: |
set -eu
npm i
cd example
npm i
- name: Check
run: |
set -eu
npm check
cd example
npm check
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Simple workflow for deploying static content to GitHub Pages
name: Deploy static content to Pages

name: Push to main (check, build, deploy example app)

on:
# Runs on pushes targeting the default branch
Expand Down Expand Up @@ -41,12 +41,18 @@ jobs:
node-version: 20.12

- name: Install dependencies
working-directory: example
run: npm i
run: |
set -eu
npm i
cd example
npm i
- name: Build app
working-directory: example
run: npm run build
- name: Check
run: |
set -eu
npm check
cd example
npm check
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
Expand Down
7 changes: 7 additions & 0 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ npm install

## Development

```sh
npm run check && cd example && npm run check
npm run precommit-fix && cd example && npm run precommit-fix
```

## Publish

- Build and preview docs
- `npm run build -- --docs docs.json`
- Open https://elm-doc-preview.netlify.app
Expand Down
4 changes: 2 additions & 2 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"start": "elm-land generate && vite",
"build": "elm-land generate && vite build --base=/elm-modular-grid",
"typecheck": "npm run build",
"format-fix-all": "elm-format --yes .",
"format-validate": "elm-format --validate .",
"format-fix-all": "elm-format --yes src/ review/",
"format-validate": "elm-format --validate src/ review/",
"review": "elm-review",
"review-fix-interactive": "elm-review --fix",
"review-fix-all": "yes | elm-review --fix-all",
Expand Down
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"scripts": {
"build": "elm make",
"typecheck": "npm run build",
"format-fix-all": "elm-format --yes .",
"format-validate": "elm-format --validate .",
"format-fix-all": "elm-format --yes src/ review/",
"format-validate": "elm-format --validate src/ review/",
"review": "elm-review",
"review-fix-interactive": "elm-review --fix",
"review-fix-all": "yes | elm-review --fix-all",
Expand All @@ -21,8 +21,7 @@
"elm-format": "^0.8.7",
"elm-review": "^2.11.1"
},
"dependencies": {
},
"dependencies": {},
"engines": {
"npm": ">=10.2.3 <11.0.0",
"node": ">=20.12.0 <21.0.0"
Expand Down

0 comments on commit a18716d

Please sign in to comment.