|
7 | 7 |
|
8 | 8 | jobs:
|
9 | 9 |
|
10 |
| - start-runner: |
11 |
| - name: Start self-hosted EC2 runner |
12 |
| - runs-on: ubuntu-latest |
13 |
| - outputs: |
14 |
| - label: ${{ steps.start-ec2-runner.outputs.label }} |
15 |
| - ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }} |
16 |
| - steps: |
17 |
| - - name: Configure AWS credentials |
18 |
| - uses: aws-actions/configure-aws-credentials@v1 |
19 |
| - with: |
20 |
| - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} |
21 |
| - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
22 |
| - aws-region: ${{ secrets.AWS_REGION }} |
23 |
| - - name: Start EC2 runner |
24 |
| - id: start-ec2-runner |
25 |
| - uses: machulav/ec2-github-runner@v2 |
26 |
| - with: |
27 |
| - mode: start |
28 |
| - github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} |
29 |
| - ec2-image-id: ami-00b46fa1102c70ff2 |
30 |
| - ec2-instance-type: t2.xlarge |
31 |
| - subnet-id: subnet-905870ae |
32 |
| - security-group-id: sg-0855631d714870b32 |
33 |
| - |
34 | 10 | build-publish-win:
|
35 |
| - needs: start-runner |
36 |
| - runs-on: ${{ needs.start-runner.outputs.label }} |
37 |
| - |
38 | 11 | steps:
|
39 | 12 | - name: Login to Docker Hub
|
40 | 13 | uses: docker/login-action@v1
|
|
79 | 52 | echo "$1"
|
80 | 53 | docker push "$i"
|
81 | 54 | done
|
82 |
| -
|
83 |
| - stop-runner: |
84 |
| - name: Stop self-hosted EC2 runner |
85 |
| - needs: |
86 |
| - - start-runner # required to get output from the start-runner job |
87 |
| - - build-publish-win # required to wait when the main job is done |
88 |
| - runs-on: ubuntu-latest |
89 |
| - if: ${{ always() }} # required to stop the runner even if the error happened in the previous jobs |
90 |
| - steps: |
91 |
| - - name: Configure AWS credentials |
92 |
| - uses: aws-actions/configure-aws-credentials@v1 |
93 |
| - with: |
94 |
| - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} |
95 |
| - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
96 |
| - aws-region: ${{ secrets.AWS_REGION }} |
97 |
| - - name: Stop EC2 runner |
98 |
| - uses: machulav/ec2-github-runner@v2 |
99 |
| - with: |
100 |
| - mode: stop |
101 |
| - github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} |
102 |
| - label: ${{ needs.start-runner.outputs.label }} |
103 |
| - ec2-instance-id: ${{ needs.start-runner.outputs.ec2-instance-id }} |
0 commit comments