|
| 1 | +name: Build templates |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + outputs: |
| 6 | + artifact-key: |
| 7 | + description: "The key of the uploaded artifact" |
| 8 | + value: "dist-${{ github.run_id }}-${{ github.run_attempt }}" |
| 9 | + templates: |
| 10 | + description: "Template filenames and descriptions" |
| 11 | + value: ${{ jobs.build.outputs.templates }} |
| 12 | + |
| 13 | +jobs: |
| 14 | + build: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + outputs: |
| 17 | + templates: ${{ steps.build.outputs.templates }} |
| 18 | + steps: |
| 19 | + - name: Checkout |
| 20 | + uses: actions/checkout@v4 |
| 21 | + - name: Setup Python |
| 22 | + uses: actions/setup-python@v5 |
| 23 | + with: |
| 24 | + python-version: 3.9 |
| 25 | + cache: pip |
| 26 | + - name: Install dependencies |
| 27 | + run: pip install -r requirements.txt |
| 28 | + - name: Build templates |
| 29 | + id: build |
| 30 | + run: | |
| 31 | + mkdir dist |
| 32 | +
|
| 33 | + python template.py -o dist/ecs-fargate-full.yml --launch-type=fargate |
| 34 | + echo "ecs-fargate-full.yml => Fargate" >> templates.txt |
| 35 | +
|
| 36 | + python template.py -o dist/ecs-fargate-no-network.yml --launch-type=fargate -N |
| 37 | + echo "ecs-fargate-no-network.yml => Fargate (no network)" >> templates.txt |
| 38 | +
|
| 39 | + python template.py -o dist/ecs-fargate-no-cluster.yml --launch-type=fargate -C -N |
| 40 | + echo "ecs-fargate-no-cluster.yml => Fargate (no cluster, no network)" >> templates.txt |
| 41 | +
|
| 42 | + python template.py -o dist/ecs-ec2-full.yml --launch-type=ec2 |
| 43 | + echo "ecs-ec2-full.yml => EC2" >> templates.txt |
| 44 | +
|
| 45 | + python template.py -o dist/ecs-ec2-no-network.yml --launch-type=ec2 -N |
| 46 | + echo "ecs-ec2-no-network.yml => EC2 (no network)" >> templates.txt |
| 47 | +
|
| 48 | + python template.py -o dist/ecs-ec2-no-cluster.yml --launch-type=ec2 -C -N |
| 49 | + echo "ecs-ec2-no-cluster.yml => EC2 (no cluster, no network)" >> templates.txt |
| 50 | +
|
| 51 | + echo 'templates<<EOF' >> $GITHUB_OUTPUT |
| 52 | + cat templates.txt >> $GITHUB_OUTPUT |
| 53 | + echo 'EOF' >> $GITHUB_OUTPUT |
| 54 | + - name: Upload templates |
| 55 | + uses: actions/upload-artifact@v4 |
| 56 | + with: |
| 57 | + name: dist-${{ github.run_id }}-${{ github.run_attempt }} |
| 58 | + path: dist |
| 59 | + retention-days: 1 |
0 commit comments