Skip to content

try to make CI env work like local env #34

try to make CI env work like local env

try to make CI env work like local env #34

Workflow file for this run

name: Node.js
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
test:
runs-on: macos-latest
strategy:
matrix:
node-version:
- 18.x # EOL: 2025-04-30
- 20.x # EOL: 2026-04-30
- 21.x # EOL: 2024-06-01
#- 22.x # REL: 2024-04-23 EOL: 2027-04-30
#- 23.x # REL: 2024-10-15 EOL: 2025-06-01
#- 24.x # REL: 2025-04-22 EOL: 2028-04-30
# See supported Node.js release schedule at https://github.com/nodejs/Release
steps:
- uses: actions/checkout@v4
with:
repository: getargv/getargv
path: getargv
token: ${{ secrets.GH_PAT }}
- name: Build libgetargv
run: make install_dylib
working-directory: getargv
- uses: actions/checkout@v4
with:
path: getargv.js
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
check-latest: true
cache-dependency-path: ./getargv.js/package-lock.json
- run: npm ci
working-directory: getargv.js
- run: cat /Users/runner/.npm/_logs/*-debug.log && false
if: ${{ failure() }}
- run: npm run build --if-present
working-directory: getargv.js
- run: npm test
working-directory: getargv.js
- name: Build
run: |
npm ci
mkdir pkg
npm pack --pack-destination ./pkg/ || ( npm pack && mv camjn-getargv*.tgz ./pkg/ )
working-directory: getargv.js
- uses: actions/upload-artifact@v3
with:
name: pack-${{ matrix.node-version }}
path: getargv.js/pkg/*
release:
needs: [ test ]
runs-on: ubuntu-latest
env:
GIT_AUTHOR_NAME: github-actions[bot]
GIT_AUTHOR_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com
GIT_COMMITTER_NAME: github-actions[bot]
GIT_COMMITTER_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GH_PAT_WRITE }}
- name: Bump Version
id: version
run: echo "version=$(npm version patch)" >> $GITHUB_OUTPUT
- name: Push tag
run: git push origin tag ${{ steps.version.outputs.version }}
- uses: actions/checkout@v4
# deliberately do NOT trigger workflow on push to main
with:
fetch-depth: 0
clean: false
ref: ${{ steps.version.outputs.version }}
token: ${{ github.token }}
- run: git status
- name: Push main
run: git push origin HEAD:main