bump setup-node action to v4 #35
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 | |
- 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@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@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 }} | |
- name: Push main | |
run: git push origin HEAD:main |