ci: autopublish workflows #17
This file contains hidden or 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: Push | |
| on: push | |
| jobs: | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 | |
| cache: "npm" | |
| - name: Install deps | |
| run: npm ci | |
| - name: Lint | |
| run: npm run lint | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 | |
| cache: "npm" | |
| - name: Install deps | |
| run: npm ci | |
| - name: Run unit tests | |
| run: npm run test | |
| create-tag-if-needed: | |
| name: Create version tag on new version | |
| runs-on: ubuntu-latest | |
| needs: [lint, test] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Create tag if needed | |
| shell: bash | |
| run: | | |
| VERSION=`jq -r '.version' package.json` | |
| if [[ "$VERSION" == "0.0.0" ]]; | |
| then | |
| # fake version, quit | |
| exit 0 | |
| fi | |
| if ! git fetch origin "v$VERSION" | |
| then | |
| git tag "v$VERSION" | |
| git push origin "v$VERSION" | |
| fi |