Skip to content
Merged
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
80 changes: 80 additions & 0 deletions .github/workflows/egg-jest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: egg-jest
permissions:
contents: read

on:
- pull_request
- push

env:
NODE_LATEST_VERSION: '24'

jobs:
jest:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
node-version: ['20', '22', '24']

steps:
- uses: actions/checkout@v6

- uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'

- name: dependencies
working-directory: egg
run: npm ci

- name: jest
working-directory: egg
run: npm run all

npm:
runs-on: ubuntu-latest
needs: jest

if: "github.event_name == 'push' && startsWith(github.ref, 'refs/tags')"

environment:
name: npm-egg
url: https://www.npmjs.com/package/atsds-egg
permissions:
id-token: write

steps:
- uses: actions/checkout@v6

- name: recovery tag information
run: git fetch --tags --force

- uses: actions/setup-node@v6
with:
node-version: ${{ env.NODE_LATEST_VERSION }}
cache: 'npm'

- name: version
working-directory: egg
run: npm version from-git --no-git-tag-version

- name: extract tag
run: |
GIT_TAG=${GITHUB_REF#refs/tags/}
TAG=$(echo $GIT_TAG | sed -E 's/^v//' | sed -E 's/[0-9\.-]//g' | sed -E 's/^$/latest/g')
echo TAG=$TAG >> $GITHUB_ENV

- name: dependencies
working-directory: egg
run: npm ci

- name: build
working-directory: egg
run: npm run build

- name: publish
working-directory: egg
run: npm publish --tag $TAG