|
| 1 | +name: Test & Maybe Release |
| 2 | +on: [push, pull_request] |
| 3 | +jobs: |
| 4 | + test: |
| 5 | + strategy: |
| 6 | + fail-fast: false |
| 7 | + matrix: |
| 8 | + node: [20.x, lts/*, current] |
| 9 | + # not quite windows ready, halp! os: [macos-latest, ubuntu-latest, windows-latest] |
| 10 | + os: [macos-latest, ubuntu-latest] |
| 11 | + runs-on: ${{ matrix.os }} |
| 12 | + steps: |
| 13 | + - name: Checkout Repository |
| 14 | + uses: actions/checkout@v4 |
| 15 | + with: |
| 16 | + fetch-depth: 0 |
| 17 | + - name: Use Node.js ${{ matrix.node }} |
| 18 | + uses: actions/setup-node@v3.8.1 |
| 19 | + with: |
| 20 | + node-version: ${{ matrix.node }} |
| 21 | + - name: Set up ghauth config (Ubuntu) |
| 22 | + run: | |
| 23 | + mkdir -p ~/.config/changelog-maker/ |
| 24 | + echo '{"user": "nodejs", "token": "'${{ secrets.GITHUB_TOKEN }}'"}' > ~/.config/changelog-maker/config.json |
| 25 | + if: startsWith(matrix.os, 'ubuntu') |
| 26 | + |
| 27 | + - name: Set up ghauth config (macOS) |
| 28 | + run: | |
| 29 | + mkdir -p ~/Library/Application\ Support/changelog-maker/ |
| 30 | + echo '{"user": "nodejs", "token": "'${{ secrets.GITHUB_TOKEN }}'"}' > ~/Library/Application\ Support/changelog-maker/config.json |
| 31 | + if: startsWith(matrix.os, 'macos') |
| 32 | + |
| 33 | + - name: Set up ghauth config (Windows) |
| 34 | + run: | |
| 35 | + mkdir "%LOCALAPPDATA%\changelog-maker\" |
| 36 | + echo {"user": "nodejs", "token": "${{ secrets.GITHUB_TOKEN }}"} > "%LOCALAPPDATA%\changelog-maker\config.json" |
| 37 | + shell: cmd |
| 38 | + if: startsWith(matrix.os, 'windows') |
| 39 | + - name: Install Dependencies |
| 40 | + run: | |
| 41 | + npm install --no-progress |
| 42 | + - name: Run tests |
| 43 | + run: | |
| 44 | + npm config set script-shell bash |
| 45 | + npm run test:ci |
| 46 | + release: |
| 47 | + name: Release |
| 48 | + needs: test |
| 49 | + runs-on: ubuntu-latest |
| 50 | + if: github.event_name == 'push' && github.ref == 'refs/heads/main' |
| 51 | + steps: |
| 52 | + - name: Checkout |
| 53 | + uses: actions/checkout@v4 |
| 54 | + with: |
| 55 | + fetch-depth: 0 |
| 56 | + - name: Setup Node.js |
| 57 | + uses: actions/setup-node@v3.8.1 |
| 58 | + with: |
| 59 | + node-version: lts/* |
| 60 | + - name: Install dependencies |
| 61 | + run: | |
| 62 | + npm install --no-progress --no-package-lock --no-save |
| 63 | + - name: Build |
| 64 | + run: | |
| 65 | + npm run build |
| 66 | + - name: Install plugins |
| 67 | + run: | |
| 68 | + npm install \ |
| 69 | + @semantic-release/commit-analyzer \ |
| 70 | + conventional-changelog-conventionalcommits \ |
| 71 | + @semantic-release/release-notes-generator \ |
| 72 | + @semantic-release/npm \ |
| 73 | + @semantic-release/github \ |
| 74 | + @semantic-release/git \ |
| 75 | + @semantic-release/changelog \ |
| 76 | + --no-progress --no-package-lock --no-save |
| 77 | + - name: Release |
| 78 | + env: |
| 79 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 80 | + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 81 | + run: npx semantic-release |
| 82 | + |
0 commit comments