set pwd when building dylib #45
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
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 | |
- 22.x # 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 dylib | |
working-directory: getargv | |
- name: Install libgetargv | |
run: sudo 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@v4 | |
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@v4 | |
with: | |
name: pack-${{ matrix.node-version }} | |
path: getargv.js/pkg/* | |
release: | |
needs: [ test ] | |
runs-on: ubuntu-latest | |
env: | |
GIT_AUTHOR_NAME: github-actions | |
GIT_AUTHOR_EMAIL: github-actions@github.com | |
GIT_COMMITTER_NAME: github-actions | |
GIT_COMMITTER_EMAIL: github-actions@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 }} | |
- name: Push main | |
run: git push origin HEAD:main |