|
1 | | -name: Release |
| 1 | +name: Deployment Workflow Monodog |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
5 | | - branches: [main] |
| 5 | + branches: |
| 6 | + - main |
| 7 | + workflow_dispatch: |
6 | 8 |
|
7 | 9 | jobs: |
8 | | - release: |
| 10 | + build: |
| 11 | + name: "@mindfiredigital/monodog Build, Lint, and Test" |
9 | 12 | runs-on: ubuntu-latest |
10 | | - if: github.ref == 'refs/heads/main' |
11 | | - |
| 13 | + permissions: |
| 14 | + contents: write # Required to create release tags and update the changelog |
| 15 | + issues: write # Required to close issues/PRs linked in the changelog |
| 16 | + pull-requests: write # Required for creating release pull requests (if configured) |
| 17 | + |
12 | 18 | steps: |
13 | | - - uses: actions/checkout@v4 |
14 | | - with: |
15 | | - fetch-depth: 0 |
16 | | - token: ${{ secrets.GITHUB_TOKEN }} |
17 | | - |
18 | | - - name: Setup Node.js |
19 | | - uses: actions/setup-node@v4 |
| 19 | + - name: "Checkout repository" |
| 20 | + uses: actions/checkout@v3 |
| 21 | + |
| 22 | + - name: Set up Node.js |
| 23 | + uses: actions/setup-node@v3 |
20 | 24 | with: |
21 | | - node-version-file: '.nvmrc' |
22 | | - registry-url: 'https://registry.npmjs.org' |
23 | | - |
| 25 | + node-version: 20 |
| 26 | + |
24 | 27 | - name: Setup pnpm |
25 | 28 | uses: pnpm/action-setup@v2 |
26 | 29 | with: |
27 | 30 | version: 8 |
28 | | - |
29 | | - - name: Install dependencies |
30 | | - run: pnpm install --frozen-lockfile |
31 | | - |
32 | | - - name: Build packages |
33 | | - run: pnpm turbo build |
34 | | - |
35 | | - - name: Run tests |
36 | | - run: pnpm turbo test |
| 31 | + |
| 32 | + - name: "Install dependencies" |
| 33 | + run: pnpm install --ignore-scripts --no-frozen-lockfile |
| 34 | + |
| 35 | + - name: "Create build" |
| 36 | + run: pnpm run build |
| 37 | + |
| 38 | + - name: "Lint code" |
| 39 | + run: pnpm run lint |
| 40 | + |
| 41 | + - name: "Run tests" |
| 42 | + run: pnpm test |
| 43 | + |
| 44 | + create-github-release: |
| 45 | + name: Create GitHub release document and publish to npm |
| 46 | + runs-on: ubuntu-latest |
| 47 | + needs: build |
| 48 | + permissions: |
| 49 | + contents: write |
| 50 | + pull-requests: write |
| 51 | + packages: write |
| 52 | + actions: write |
| 53 | + |
| 54 | + steps: |
| 55 | + - name: Checkout repository |
| 56 | + uses: actions/checkout@v4 |
| 57 | + with: |
| 58 | + fetch-depth: 0 |
| 59 | + |
| 60 | + - name: Set up Node.js |
| 61 | + uses: actions/setup-node@v4 |
| 62 | + with: |
| 63 | + node-version: 20 |
| 64 | + |
| 65 | + - name: Enable Corepack |
| 66 | + run: npm install -g pnpm |
| 67 | + |
| 68 | + - name: 'Install dependencies with pnpm' |
| 69 | + run: pnpm install --no-frozen-lockfile --ignore-scripts |
| 70 | + |
| 71 | + - name: 'Build application' |
| 72 | + run: pnpm turbo run build |
| 73 | + |
| 74 | + - name: 'Set Git user name and email' |
| 75 | + run: | |
| 76 | + git config --local user.email "github-actions@github.com" |
| 77 | + git config --local user.name "GitHub Actions" |
| 78 | +
|
| 79 | + - name: Generate Changeset from commit messages |
| 80 | + run: pnpm changeset:autogenerate |
| 81 | + |
| 82 | + - name: Create Release Pull Request or Publish to npm |
| 83 | + id: changesets |
| 84 | + uses: changesets/action@v1.4.1 |
| 85 | + with: |
| 86 | + publish: npx changeset publish |
| 87 | + env: |
| 88 | + # GITHUB_TOKEN is used for GitHub releases/tags/comments |
| 89 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 90 | + # NPM_TOKEN is used for publishing to the npm registry |
| 91 | + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 92 | + |
0 commit comments