|
| 1 | +name: Deploy to npm |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + branches: [main] |
| 6 | + push: |
| 7 | + branches: [main] |
| 8 | + |
| 9 | +permissions: |
| 10 | + id-token: write |
| 11 | + contents: write |
| 12 | + |
| 13 | +jobs: |
| 14 | + build: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + concurrency: |
| 17 | + group: build |
| 18 | + steps: |
| 19 | + - uses: actions/checkout@v4 |
| 20 | + - name: Use Node.js |
| 21 | + uses: actions/setup-node@v4 |
| 22 | + with: |
| 23 | + node-version: "20" |
| 24 | + registry-url: "https://registry.npmjs.org" |
| 25 | + - name: Install dependencies |
| 26 | + run: npm ci |
| 27 | + - name: Typecheck |
| 28 | + run: npm run typecheck |
| 29 | + - name: Build |
| 30 | + run: npm run build |
| 31 | + - name: Configure AWS Credentials |
| 32 | + uses: aws-actions/configure-aws-credentials@v4 |
| 33 | + with: |
| 34 | + aws-region: eu-west-1 |
| 35 | + role-to-assume: ${{ secrets.AWS_ROLE }} |
| 36 | + role-session-name: GitHubActions |
| 37 | + - name: Bootstrap CDK |
| 38 | + # so I do not have to do it manually when CDK is updated |
| 39 | + run: npx cdk bootstrap aws://${{secrets.AWS_ACCOUNT_ID}}/eu-west-1 |
| 40 | + - uses: actions/upload-artifact@v4 |
| 41 | + with: |
| 42 | + name: dist |
| 43 | + path: dist |
| 44 | + |
| 45 | + test-cdk-basic: |
| 46 | + needs: |
| 47 | + - build |
| 48 | + runs-on: ubuntu-latest |
| 49 | + concurrency: |
| 50 | + group: test-cdk-basic |
| 51 | + steps: |
| 52 | + - uses: actions/checkout@v4 |
| 53 | + - name: Use Node.js |
| 54 | + uses: actions/setup-node@v4 |
| 55 | + with: |
| 56 | + node-version: "20" |
| 57 | + registry-url: "https://registry.npmjs.org" |
| 58 | + - name: Install dependencies |
| 59 | + run: npm ci |
| 60 | + - uses: actions/download-artifact@v4 |
| 61 | + with: |
| 62 | + name: dist |
| 63 | + path: dist |
| 64 | + - name: Configure AWS Credentials |
| 65 | + uses: aws-actions/configure-aws-credentials@v4 |
| 66 | + with: |
| 67 | + aws-region: eu-west-1 |
| 68 | + role-to-assume: ${{ secrets.AWS_ROLE }} |
| 69 | + role-session-name: GitHubActions |
| 70 | + - name: Destroy |
| 71 | + run: npm run destroy |
| 72 | + working-directory: test/cdk-basic |
| 73 | + continue-on-error: true |
| 74 | + - name: Deploy |
| 75 | + run: npm run deploy |
| 76 | + working-directory: test/cdk-basic |
| 77 | + - name: Test |
| 78 | + run: DISABLE_PARALLEL_DEPLOY=true npx vitest --retry 1 test/cdk-basic.test.ts |
| 79 | + - name: Test - observable mode |
| 80 | + run: OBSERVABLE_MODE=true DISABLE_PARALLEL_DEPLOY=true npx vitest --retry 1 test/cdk-basic.test.ts |
| 81 | + |
| 82 | + test-sls-basic: |
| 83 | + needs: |
| 84 | + - build |
| 85 | + runs-on: ubuntu-latest |
| 86 | + concurrency: |
| 87 | + group: test-sls-basic |
| 88 | + steps: |
| 89 | + - uses: actions/checkout@v4 |
| 90 | + - name: Use Node.js |
| 91 | + uses: actions/setup-node@v4 |
| 92 | + with: |
| 93 | + node-version: "20" |
| 94 | + registry-url: "https://registry.npmjs.org" |
| 95 | + - name: Install dependencies |
| 96 | + run: npm ci |
| 97 | + - uses: actions/download-artifact@v4 |
| 98 | + with: |
| 99 | + name: dist |
| 100 | + path: dist |
| 101 | + - name: Configure AWS Credentials |
| 102 | + uses: aws-actions/configure-aws-credentials@v4 |
| 103 | + with: |
| 104 | + aws-region: eu-west-1 |
| 105 | + role-to-assume: ${{ secrets.AWS_ROLE }} |
| 106 | + role-session-name: GitHubActions |
| 107 | + - name: Destroy |
| 108 | + run: npm run destroy |
| 109 | + working-directory: test/sls-basic |
| 110 | + continue-on-error: true |
| 111 | + - name: Deploy |
| 112 | + run: npm run deploy |
| 113 | + working-directory: test/sls-basic |
| 114 | + - name: Test |
| 115 | + run: DISABLE_PARALLEL_DEPLOY=true npx vitest --retry 1 test/sls-basic.test.ts |
| 116 | + - name: Test - observable mode |
| 117 | + run: OBSERVABLE_MODE=true DISABLE_PARALLEL_DEPLOY=true npx vitest --retry 1 test/sls-basic.test.ts |
| 118 | + |
| 119 | + test-sls-esbuild-cjs: |
| 120 | + needs: |
| 121 | + - build |
| 122 | + runs-on: ubuntu-latest |
| 123 | + concurrency: |
| 124 | + group: test-sls-esbuild-cjs |
| 125 | + steps: |
| 126 | + - uses: actions/checkout@v4 |
| 127 | + - name: Use Node.js |
| 128 | + uses: actions/setup-node@v4 |
| 129 | + with: |
| 130 | + node-version: "20" |
| 131 | + registry-url: "https://registry.npmjs.org" |
| 132 | + - name: Install dependencies |
| 133 | + run: npm ci |
| 134 | + - uses: actions/download-artifact@v4 |
| 135 | + with: |
| 136 | + name: dist |
| 137 | + path: dist |
| 138 | + - name: Configure AWS Credentials |
| 139 | + uses: aws-actions/configure-aws-credentials@v4 |
| 140 | + with: |
| 141 | + aws-region: eu-west-1 |
| 142 | + role-to-assume: ${{ secrets.AWS_ROLE }} |
| 143 | + role-session-name: GitHubActions |
| 144 | + - name: Destroy |
| 145 | + run: npm run destroy |
| 146 | + working-directory: test/sls-esbuild-cjs |
| 147 | + continue-on-error: true |
| 148 | + - name: Deploy |
| 149 | + run: npm run deploy |
| 150 | + working-directory: test/sls-esbuild-cjs |
| 151 | + - name: Test |
| 152 | + run: DISABLE_PARALLEL_DEPLOY=true npx vitest --retry 1 test/sls-esbuild-cjs.test.ts |
| 153 | + - name: Test - observable mode |
| 154 | + run: OBSERVABLE_MODE=true DISABLE_PARALLEL_DEPLOY=true npx vitest --retry 1 test/sls-esbuild-cjs.test.ts |
| 155 | + |
| 156 | + test-sls-esbuild-esm: |
| 157 | + needs: |
| 158 | + - build |
| 159 | + runs-on: ubuntu-latest |
| 160 | + concurrency: |
| 161 | + group: test-sls-esbuild-esm |
| 162 | + steps: |
| 163 | + - uses: actions/checkout@v4 |
| 164 | + - name: Use Node.js |
| 165 | + uses: actions/setup-node@v4 |
| 166 | + with: |
| 167 | + node-version: "20" |
| 168 | + registry-url: "https://registry.npmjs.org" |
| 169 | + - name: Install dependencies |
| 170 | + run: npm ci |
| 171 | + - uses: actions/download-artifact@v4 |
| 172 | + with: |
| 173 | + name: dist |
| 174 | + path: dist |
| 175 | + - name: Configure AWS Credentials |
| 176 | + uses: aws-actions/configure-aws-credentials@v4 |
| 177 | + with: |
| 178 | + aws-region: eu-west-1 |
| 179 | + role-to-assume: ${{ secrets.AWS_ROLE }} |
| 180 | + role-session-name: GitHubActions |
| 181 | + - name: Destroy |
| 182 | + run: npm run destroy |
| 183 | + working-directory: test/sls-esbuild-esm |
| 184 | + continue-on-error: true |
| 185 | + - name: Deploy |
| 186 | + run: npm run deploy |
| 187 | + working-directory: test/sls-esbuild-esm |
| 188 | + - name: Test |
| 189 | + run: DISABLE_PARALLEL_DEPLOY=true npx vitest --retry 1 test/sls-esbuild-esm.test.ts |
| 190 | + - name: Test - observable mode |
| 191 | + run: OBSERVABLE_MODE=true DISABLE_PARALLEL_DEPLOY=true npx vitest --retry 1 test/sls-esbuild-esm.test.ts |
| 192 | + |
| 193 | + test-sam-basic: |
| 194 | + needs: |
| 195 | + - build |
| 196 | + runs-on: ubuntu-latest |
| 197 | + concurrency: |
| 198 | + group: test-sam-basic |
| 199 | + steps: |
| 200 | + - uses: actions/checkout@v4 |
| 201 | + - uses: aws-actions/setup-sam@v2 |
| 202 | + with: |
| 203 | + use-installer: true |
| 204 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 205 | + - name: Use Node.js |
| 206 | + uses: actions/setup-node@v4 |
| 207 | + with: |
| 208 | + node-version: "20" |
| 209 | + registry-url: "https://registry.npmjs.org" |
| 210 | + - name: Install dependencies |
| 211 | + run: npm ci |
| 212 | + - uses: actions/download-artifact@v4 |
| 213 | + with: |
| 214 | + name: dist |
| 215 | + path: dist |
| 216 | + - name: Configure AWS Credentials |
| 217 | + uses: aws-actions/configure-aws-credentials@v4 |
| 218 | + with: |
| 219 | + aws-region: eu-west-1 |
| 220 | + role-to-assume: ${{ secrets.AWS_ROLE }} |
| 221 | + role-session-name: GitHubActions |
| 222 | + - name: Destroy |
| 223 | + run: npm run destroy |
| 224 | + working-directory: test/sam-basic |
| 225 | + continue-on-error: true |
| 226 | + - name: Deploy |
| 227 | + run: npm run deploy |
| 228 | + working-directory: test/sam-basic |
| 229 | + - name: Test |
| 230 | + run: DISABLE_PARALLEL_DEPLOY=true npx vitest --retry 1 test/sam-basic.test.ts |
| 231 | + - name: Test - observable mode |
| 232 | + run: OBSERVABLE_MODE=true DISABLE_PARALLEL_DEPLOY=true npx vitest --retry 1 test/sam-basic.test.ts |
| 233 | + |
| 234 | + test-terraform-basic: |
| 235 | + needs: |
| 236 | + - build |
| 237 | + runs-on: ubuntu-latest |
| 238 | + concurrency: |
| 239 | + group: test-terraform-basic |
| 240 | + steps: |
| 241 | + - uses: actions/checkout@v4 |
| 242 | + - name: Use Node.js |
| 243 | + uses: actions/setup-node@v4 |
| 244 | + with: |
| 245 | + node-version: "20" |
| 246 | + registry-url: "https://registry.npmjs.org" |
| 247 | + - name: Install dependencies |
| 248 | + run: npm ci |
| 249 | + - uses: actions/download-artifact@v4 |
| 250 | + with: |
| 251 | + name: dist |
| 252 | + path: dist |
| 253 | + - name: Configure AWS Credentials |
| 254 | + uses: aws-actions/configure-aws-credentials@v4 |
| 255 | + with: |
| 256 | + aws-region: eu-west-1 |
| 257 | + role-to-assume: ${{ secrets.AWS_ROLE }} |
| 258 | + role-session-name: GitHubActions |
| 259 | + - name: Setup Terraform |
| 260 | + uses: hashicorp/setup-terraform@v1 |
| 261 | + - name: Terraform Init |
| 262 | + run: | |
| 263 | + ./create_bucket.sh lld-terraform-basic |
| 264 | + terraform init -backend-config="bucket=lld-terraform-basic" |
| 265 | + working-directory: test/terraform-basic |
| 266 | + - name: Destroy |
| 267 | + run: npm run destroy |
| 268 | + working-directory: test/terraform-basic |
| 269 | + continue-on-error: true |
| 270 | + - name: Deploy |
| 271 | + run: npm run deploy |
| 272 | + working-directory: test/terraform-basic |
| 273 | + - name: Test |
| 274 | + run: DISABLE_PARALLEL_DEPLOY=true npx vitest --retry 1 test/terraform-basic.test.ts |
| 275 | + - name: Test - observable mode |
| 276 | + run: OBSERVABLE_MODE=true DISABLE_PARALLEL_DEPLOY=true npx vitest --retry 1 test/terraform-basic.test.ts |
| 277 | + |
| 278 | + # publish: |
| 279 | + # needs: |
| 280 | + # - test-cdk-basic |
| 281 | + # - test-sls-basic |
| 282 | + # - test-sls-esbuild-cjs |
| 283 | + # - test-sls-esbuild-esm |
| 284 | + # - test-sam-basic |
| 285 | + # - test-terraform-basic |
| 286 | + # runs-on: ubuntu-latest |
| 287 | + # concurrency: |
| 288 | + # group: publish |
| 289 | + # steps: |
| 290 | + # - uses: actions/checkout@v4 |
| 291 | + # - name: Use Node.js |
| 292 | + # uses: actions/setup-node@v4 |
| 293 | + # with: |
| 294 | + # node-version: "20" |
| 295 | + # registry-url: "https://registry.npmjs.org" |
| 296 | + # - name: Install dependencies |
| 297 | + # run: npm ci |
| 298 | + # - uses: actions/download-artifact@v4 |
| 299 | + # with: |
| 300 | + # name: dist |
| 301 | + # path: dist |
| 302 | + # - name: Semantic Release |
| 303 | + # run: | |
| 304 | + # npm whoami |
| 305 | + # npx semantic-release |
| 306 | + # env: |
| 307 | + # GITHUB_TOKEN: ${{ secrets.PRIVATE_GITHUB_TOKEN }} |
| 308 | + # NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 309 | + # NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
0 commit comments