Dev #60
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
# A workflow of VICSOLWANG's project | |
name: test-release-ci | |
on: | |
push: | |
branches: [ master, dev ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
test: | |
strategy: | |
matrix: | |
node_version: ['18'] | |
os: [ubuntu-latest, windows-latest, macOS-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- if: matrix.os == 'windows-latest' | |
run: git config --global core.autocrlf false | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node_version }} | |
- uses: actions/cache@v3 | |
id: cache-node_modules | |
with: | |
path: node_modules | |
key: ${{ matrix.os }}-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ matrix.os }}-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }} | |
- run: node --version | |
- run: npm --version | |
- run: npm install | |
- run: npm test | |
- run: npm run cover:report | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: coverage | |
path: coverage.lcov | |
codecov: | |
runs-on: ubuntu-latest | |
needs: | |
- test | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: coverage | |
- uses: codecov/codecov-action@v3 | |
release: | |
needs: test | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' && github.ref_name == 'master' | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- run: npm install is-ci | |
- uses: cycjimmy/semantic-release-action@v4 | |
id: semantic | |
with: | |
extra_plugins: | | |
@semantic-release/changelog | |
@semantic-release/git | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- if: steps.semantic.outputs.new_release_published == 'true' | |
run: echo ${{ steps.semantic.outputs.new_release_version }} |