chore: automated deployment 2025-10-02 06:12:33 #13
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: 'ci' | |
| on: | |
| push: | |
| branches: | |
| - '**' | |
| - '!renovate/**' | |
| paths-ignore: | |
| - README.md | |
| pull_request: | |
| branches: | |
| - '**' | |
| workflow_dispatch: | |
| inputs: | |
| deploy_type: | |
| description: 'Deployment type' | |
| required: true | |
| default: 'patch' | |
| type: choice | |
| options: | |
| - patch | |
| - minor | |
| - major | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| name: Build and Test | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| submodules: true | |
| - uses: actions/setup-node@v5 | |
| with: | |
| node-version: 22 | |
| cache: 'npm' | |
| - run: npm install | |
| - run: npm run build | |
| - run: npm run format:check | |
| - run: npm run lint | |
| - run: npm run test:unit | |
| release: | |
| needs: test | |
| runs-on: ubuntu-latest | |
| if: github.ref == 'refs/heads/main' | |
| permissions: | |
| contents: write # Required to push tags and commits | |
| id-token: write # Required for provenance | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| submodules: true | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - uses: actions/setup-node@v5 | |
| with: | |
| node-version: 'lts/*' # Use LTS for publishing | |
| registry-url: 'https://registry.npmjs.org' | |
| cache: 'npm' | |
| - run: npm install | |
| - name: Configure Git | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: Create Release Commit and Tag | |
| run: npm run release | |
| - name: Push Release Commit and Tag | |
| run: git push --follow-tags origin main | |
| - name: Publish to npm | |
| run: npm publish | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| deploy: | |
| needs: test | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'workflow_dispatch' | |
| permissions: | |
| contents: write | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| submodules: true | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - uses: actions/setup-node@v5 | |
| with: | |
| node-version: 'lts/*' | |
| registry-url: 'https://registry.npmjs.org' | |
| cache: 'npm' | |
| - run: npm install | |
| - name: Configure Git | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: Automated Deployment | |
| run: | | |
| npm run build | |
| npm run format | |
| npm run lint:fix | |
| npm run release | |
| git add . | |
| git commit -m "chore: automated deployment $(date +'%Y-%m-%d %H:%M:%S')" || echo "No changes to commit" | |
| git push origin main | |
| git push origin --tags || echo "No tags to push" | |
| - name: Publish to npm | |
| run: npm publish | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |