|
1 | 1 | name: Build, Test, Deploy |
2 | 2 |
|
3 | 3 | on: |
4 | | - workflow_dispatch: |
5 | | - inputs: |
6 | | - environment: |
7 | | - description: Environment where to deploy the stack (dev, staging) |
8 | | - type: environment |
9 | | - required: true |
10 | | - workflow_call: |
11 | | - inputs: |
12 | | - environment: |
13 | | - description: Environment where to deploy the stack (dev, staging) |
14 | | - type: string |
15 | | - required: true |
16 | | - |
17 | | -env: |
18 | | - AWS_REGION: eu-north-1 |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + environment: |
| 7 | + description: Environment where to deploy the stack (dev, staging) |
| 8 | + type: environment |
| 9 | + required: true |
| 10 | + workflow_call: |
| 11 | + inputs: |
| 12 | + environment: |
| 13 | + description: Environment where to deploy the stack (dev, staging) |
| 14 | + type: string |
| 15 | + required: true |
19 | 16 |
|
20 | 17 | jobs: |
21 | | - build-test-deploy: |
22 | | - name: Build, test and deploy ${{ inputs.environment }} |
23 | | - runs-on: ubuntu-latest |
24 | | - environment: ${{ inputs.environment }} |
25 | | - outputs: |
26 | | - url: ${{ steps.pulumi.outputs.url }} |
27 | | - steps: |
28 | | - - uses: actions/checkout@v3 |
29 | | - - name: Use Node.js |
30 | | - uses: actions/setup-node@v3 |
31 | | - with: |
32 | | - node-version: 18.x |
33 | | - - name: Build |
34 | | - run: | |
35 | | - npm install |
36 | | - npm run build |
37 | | - - name: Test |
38 | | - run: | |
39 | | - npm run test |
40 | | - - name: prepare deployment |
41 | | - run: | |
42 | | - npm run build:infra |
43 | | - - name: Configure AWS credentials |
44 | | - uses: aws-actions/configure-aws-credentials@v1 |
45 | | - with: |
46 | | - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} |
47 | | - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
48 | | - aws-region: ${{ env.AWS_REGION }} |
49 | | - - name: Deploy with Pulumi |
50 | | - id: pulumi |
51 | | - uses: pulumi/actions@v3 |
52 | | - with: |
53 | | - work-dir: ./infra |
54 | | - command: up |
55 | | - stack-name: virtualfinland/${{ inputs.environment }} |
56 | | - upsert: true |
57 | | - env: |
58 | | - PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }} |
59 | | - - name: Tag the deployment |
60 | | - uses: Virtual-Finland-Development/automatic-release-action@v1.0 |
61 | | - if: ${{ inputs.environment == 'staging' }} |
62 | | - with: |
63 | | - environment: ${{ inputs.environment }} |
64 | | - githubToken: ${{ secrets.GITHUB_TOKEN }} |
| 18 | + build-test-deploy: |
| 19 | + name: Build, test and deploy ${{ inputs.environment }} |
| 20 | + runs-on: ubuntu-latest |
| 21 | + permissions: |
| 22 | + id-token: write |
| 23 | + contents: read |
| 24 | + environment: ${{ inputs.environment }} |
| 25 | + steps: |
| 26 | + - uses: actions/checkout@v3 |
| 27 | + - name: Use Node.js |
| 28 | + uses: actions/setup-node@v3 |
| 29 | + with: |
| 30 | + node-version: 18.x |
| 31 | + - name: Build |
| 32 | + run: | |
| 33 | + npm install |
| 34 | + npm run build |
| 35 | + - name: Test |
| 36 | + run: | |
| 37 | + npm run test |
| 38 | + - name: prepare deployment |
| 39 | + run: | |
| 40 | + npm run build:infra |
| 41 | + - name: Configure AWS credentials |
| 42 | + uses: Virtual-Finland-Development/infrastructure/.github/actions/configure-aws-credentials@main |
| 43 | + with: |
| 44 | + environment: ${{ inputs.environment }} |
| 45 | + aws-region: ${{ secrets.AWS_REGION }} |
| 46 | + pulumi-access-token: ${{ secrets.PULUMI_ACCESS_TOKEN }} |
| 47 | + - name: Deploy with Pulumi |
| 48 | + id: pulumi |
| 49 | + uses: pulumi/actions@v4 |
| 50 | + with: |
| 51 | + work-dir: ./infra |
| 52 | + command: up |
| 53 | + stack-name: virtualfinland/${{ inputs.environment }} |
| 54 | + upsert: true |
| 55 | + env: |
| 56 | + PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }} |
| 57 | + - name: Tag the deployment |
| 58 | + uses: Virtual-Finland-Development/automatic-release-action@v1.0 |
| 59 | + if: ${{ inputs.environment == 'staging' }} |
| 60 | + with: |
| 61 | + environment: ${{ inputs.environment }} |
| 62 | + githubToken: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments