|
10 | 10 | - created |
11 | 11 |
|
12 | 12 | env: |
13 | | - ESM_NAME: "@openmrs/esm-cohort-builder-app" |
14 | | - JS_NAME: "openmrs-esm-cohort-builder-app.js" |
| 13 | + TURBO_API: 'http://127.0.0.1:9080' |
| 14 | + TURBO_TOKEN: 'turbo-token' |
| 15 | + TURBO_TEAM: ${{ github.repository_owner }} |
15 | 16 |
|
16 | 17 | jobs: |
17 | 18 | build: |
18 | 19 | runs-on: ubuntu-latest |
19 | 20 |
|
20 | 21 | steps: |
21 | 22 | - uses: actions/checkout@v4 |
22 | | - - name: Use Node.js |
| 23 | + - name: 🛠️ Setup Node.js |
23 | 24 | uses: actions/setup-node@v4 |
24 | 25 | with: |
25 | | - node-version: "18.x" |
26 | | - - run: yarn install --immutable |
27 | | - - run: yarn verify |
28 | | - - run: yarn build |
29 | | - - name: Upload Artifacts |
30 | | - uses: actions/upload-artifact@v3 |
| 26 | + node-version: "18" |
| 27 | + |
| 28 | + - name: 💾 Cache dependencies |
| 29 | + id: cache |
| 30 | + uses: actions/cache@v4 |
| 31 | + with: |
| 32 | + path: '**/node_modules' |
| 33 | + key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} |
| 34 | + |
| 35 | + - name: 📦 Install dependencies |
| 36 | + if: steps.cache.outputs.cache-hit != 'true' |
| 37 | + run: yarn install --immutable |
| 38 | + |
| 39 | + - name: 🚀 Setup local cache server for Turborepo |
| 40 | + uses: felixmosh/turborepo-gh-artifacts@v3 |
| 41 | + with: |
| 42 | + repo-token: ${{ secrets.GITHUB_TOKEN }} |
| 43 | + server-token: ${{ env.TURBO_TOKEN }} |
| 44 | + |
| 45 | + - name: 🧪 Run tests, lint and type checks |
| 46 | + run: yarn verify |
| 47 | + |
| 48 | + - name: 🏗️ Run build |
| 49 | + run: yarn turbo run build |
| 50 | + |
| 51 | + - name: 📤 Upload Artifacts |
| 52 | + uses: actions/upload-artifact@v4 |
31 | 53 | with: |
32 | 54 | name: dist |
33 | 55 | path: | |
34 | 56 | dist |
| 57 | + overwrite: true |
35 | 58 |
|
36 | 59 | pre_release: |
37 | 60 | runs-on: ubuntu-latest |
38 | | - |
39 | 61 | needs: build |
40 | | - |
41 | 62 | if: ${{ github.event_name == 'push' }} |
42 | 63 |
|
43 | 64 | steps: |
44 | | - - run: echo "Uncomment the lines below and delete this one." |
45 | 65 | - uses: actions/checkout@v4 |
46 | | - - name: Download Artifacts |
47 | | - uses: actions/download-artifact@v4 |
48 | | - - name: Use Node.js |
| 66 | + - name: 🛠️ Setup Node.js |
49 | 67 | uses: actions/setup-node@v4 |
50 | 68 | with: |
51 | | - node-version: "18.x" |
52 | | - registry-url: "https://registry.npmjs.org" |
53 | | - - run: yarn install --immutable |
54 | | - - run: yarn version "$(node -e "console.log(require('semver').inc(require('./package.json').version, 'patch'))")-pre.${{ github.run_number }}" |
55 | | - - run: yarn build |
56 | | - - run: git config user.email "info@openmrs.org" && git config user.name "OpenMRS CI" |
57 | | - - run: git add . && git commit -m "Prerelease version" --no-verify |
58 | | - - run: yarn config set npmAuthToken "${NODE_AUTH_TOKEN}" && yarn npm publish --access public --tag next |
| 69 | + node-version: "18" |
| 70 | + |
| 71 | + - name: 💾 Cache dependencies |
| 72 | + id: cache |
| 73 | + uses: actions/cache@v4 |
| 74 | + with: |
| 75 | + path: '**/node_modules' |
| 76 | + key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} |
| 77 | + |
| 78 | + - name: 📦 Install dependencies |
| 79 | + if: steps.cache.outputs.cache-hit != 'true' |
| 80 | + run: yarn install --immutable |
| 81 | + |
| 82 | + - name: 🚀 Setup local cache server for Turborepo |
| 83 | + uses: felixmosh/turborepo-gh-artifacts@v3 |
| 84 | + with: |
| 85 | + repo-token: ${{ secrets.GITHUB_TOKEN }} |
| 86 | + server-token: ${{ env.TURBO_TOKEN }} |
| 87 | + |
| 88 | + - name: 🏷️ Version |
| 89 | + run: yarn version "$(node -e "console.log(require('semver').inc(require('./package.json').version, 'patch'))")-pre.${{ github.run_number }}" |
| 90 | + |
| 91 | + - name: 🏗️ Build |
| 92 | + run: yarn turbo run build |
| 93 | + |
| 94 | + - name: 🔧 Configure Git |
| 95 | + run: git config user.email "info@openmrs.org" && git config user.name "OpenMRS CI" |
| 96 | + - name: 💾 Commit changes |
| 97 | + run: git add . && git commit -m "Prerelease version" --no-verify |
| 98 | + |
| 99 | + - name: 🚀 Pre-release |
| 100 | + run: yarn config set npmAuthToken "${NODE_AUTH_TOKEN}" && yarn npm publish --access public --tag next |
59 | 101 | env: |
60 | 102 | NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} |
61 | | - - name: Upload Artifacts |
62 | | - uses: actions/upload-artifact@v3 |
| 103 | + - name: 📤 Upload Artifacts |
| 104 | + uses: actions/upload-artifact@v4 |
63 | 105 | with: |
64 | 106 | name: dist |
65 | 107 | path: | |
66 | 108 | dist |
| 109 | + overwrite: true |
67 | 110 |
|
68 | 111 | release: |
69 | 112 | runs-on: ubuntu-latest |
70 | | - |
71 | 113 | needs: build |
72 | | - |
73 | 114 | if: ${{ github.event_name == 'release' }} |
74 | 115 |
|
75 | 116 | steps: |
76 | 117 | - uses: actions/checkout@v4 |
77 | | - - name: Download Artifacts |
| 118 | + - name: 📥 Download Artifacts |
78 | 119 | uses: actions/download-artifact@v4 |
79 | | - - name: Use Node.js |
| 120 | + - name: 🛠️ Use Node.js |
80 | 121 | uses: actions/setup-node@v4 |
81 | 122 | with: |
82 | | - node-version: "18.x" |
| 123 | + node-version: "18" |
83 | 124 | registry-url: 'https://registry.npmjs.org' |
84 | | - - run: yarn install --immutable |
85 | | - - run: yarn config set npmAuthToken "${NODE_AUTH_TOKEN}" && yarn npm publish --access public |
| 125 | + |
| 126 | + - name: 💾 Cache dependencies |
| 127 | + id: cache |
| 128 | + uses: actions/cache@v4 |
| 129 | + with: |
| 130 | + path: '**/node_modules' |
| 131 | + key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} |
| 132 | + |
| 133 | + - name: 📦 Install dependencies |
| 134 | + if: steps.cache.outputs.cache-hit != 'true' |
| 135 | + run: yarn install --immutable |
| 136 | + |
| 137 | + - name: 🚀 Setup local cache server for Turborepo |
| 138 | + uses: felixmosh/turborepo-gh-artifacts@v3 |
| 139 | + with: |
| 140 | + repo-token: ${{ secrets.GITHUB_TOKEN }} |
| 141 | + server-token: ${{ env.TURBO_TOKEN }} |
| 142 | + |
| 143 | + - name: 🏗️ Build |
| 144 | + run: yarn turbo run build |
| 145 | + |
| 146 | + - name: 🚀 Publish to NPM |
| 147 | + run: yarn config set npmAuthToken "${NODE_AUTH_TOKEN}" && yarn npm publish --access public |
86 | 148 | env: |
87 | 149 | NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} |
88 | 150 |
|
| 151 | + - name: 📤 Upload Artifacts |
| 152 | + uses: actions/upload-artifact@v4 |
| 153 | + with: |
| 154 | + name: dist |
| 155 | + path: | |
| 156 | + dist |
| 157 | + overwrite: true |
| 158 | + |
89 | 159 | deploy: |
90 | 160 | runs-on: ubuntu-latest |
91 | | - |
92 | 161 | needs: pre_release |
93 | | - |
94 | 162 | if: ${{ github.event_name == 'push' }} |
95 | 163 |
|
96 | 164 | steps: |
97 | | - - name: Trigger RefApp Build |
98 | | - uses: fjogeleit/http-request-action@master |
| 165 | + - name: 🚀 Trigger RefApp Build |
| 166 | + uses: fjogeleit/http-request-action@v1 |
99 | 167 | with: |
100 | 168 | url: https://ci.openmrs.org/rest/api/latest/queue/O3-BF |
101 | 169 | method: "POST" |
|
0 commit comments