-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #77 from OriginTrail/github-actions
Github actions
- Loading branch information
Showing
4 changed files
with
111 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: setup | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Setup NodeJS | ||
id: nodejs | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16.x | ||
cache: npm | ||
|
||
- name: Cache node modules | ||
id: cache-node-modules | ||
uses: actions/cache@v3 | ||
with: | ||
path: '**/node_modules' | ||
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }} | ||
${{ runner.os }}-node-modules- | ||
- if: steps.cache-node-modules.outputs.cache-hit != 'true' | ||
name: Install dependencies | ||
shell: bash | ||
run: npm ci |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Build and Commit | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build-and-commit: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up environment | ||
uses: ./.github/actions/setup | ||
|
||
- name: Run build | ||
run: npm run build | ||
|
||
- name: Commit and push if it changed | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "GitHub Action" | ||
git add -A | ||
message="Automated build commit | ||
Co-authored-by: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>" | ||
git diff --quiet && git diff --staged --quiet || git commit -m "$message" | ||
git push |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: npm-publish | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up environment | ||
uses: ./.github/actions/setup | ||
|
||
- name: Run linter | ||
run: npm run lint | ||
|
||
publish-npm: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up environment | ||
uses: ./.github/actions/setup | ||
|
||
- name: Publish npm package | ||
run: npm publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{secrets.npm_token}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: update-cache | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
concurrency: | ||
group: update-cache-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build-cache: | ||
name: Build Cache | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up environment | ||
uses: ./.github/actions/setup |