Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/GitHub Action #53

Merged
merged 1 commit into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 25 additions & 21 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,28 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

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

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build docs
run: pnpm run docs
- name: Copy example folder
run: cp -R example docs/example

- name: Deploy to GitHub Pages
uses: JamesIves/[email protected]
with:
branch: gh-pages
folder: docs
- name: Checkout code
uses: actions/checkout@v2

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

- uses: pnpm/[email protected]
with:
version: 8.7.1

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build docs
run: pnpm run docs
- name: Copy example folder
run: cp -R example docs/example

- name: Deploy to GitHub Pages
uses: JamesIves/[email protected]
with:
branch: gh-pages
folder: docs
30 changes: 0 additions & 30 deletions .github/workflows/npm-beta-publish.yml

This file was deleted.

23 changes: 17 additions & 6 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ name: Publish Package to npm.js

on:
release:
types: [published]
repository_dispatch:
types: [publish-npm]
types: [ published ]
pull_request:
types:
- closed

jobs:

Expand All @@ -25,7 +26,17 @@ jobs:
- run: pnpm lint
- run: pnpm test
- run: pnpm build
- uses: JS-DevTools/npm-publish@v2
- name: Determine Target Branch
id: determine-branch
run: echo "::set-output name=branch::${{ github.event.pull_request.base.ref }}"

- name: Determine Tag
id: determine-tag
run: echo "::set-output name=tag::${{ steps.determine-branch.outputs.branch == 'master' && 'latest' || 'beta' }}"

- name: Publish Package
uses: JS-DevTools/npm-publish@v2
with:
token: ${{secrets.npm_token}}
provenance: true
token: ${{secrets.npm_token}}
provenance: true
tag: ${{ steps.determine-tag.outputs.tag }}
24 changes: 5 additions & 19 deletions .github/workflows/pr-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,30 +28,16 @@ jobs:
- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Run tests
run: pnpm test

- uses: jwalton/gh-find-current-pr@v1
id: findPr

- name: jest coverage report
uses: ArtiomTr/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
prnumber: ${{ steps.findPr.outputs.number }}

- name: Check test status
id: test-status
run: echo "::set-output name=status::$(if grep -q 'Test failed' test-results.txt; then echo 'failure'; else echo 'success'; fi)"

merge:
needs: test
runs-on: ubuntu-latest
if: ${{ needs.test.outputs.status == 'success' }}

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Trigger npm-publish workflow
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
repository: ishiko732/ts-fsrs
event-type: publish-npm
run: echo "::set-output name=status::$(if grep -q 'Test failed' test-results.txt; then echo 'failure'; else echo 'success'; fi)"
Loading