-
Notifications
You must be signed in to change notification settings - Fork 2
62 lines (56 loc) · 1.7 KB
/
base_aws_image.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
---
name: Base Internal build/test image for AWS
on:
workflow_call:
inputs:
distrib:
required: true
type: string
techno:
required: true
type: string
product:
required: true
type: string
base-version:
required: true
type: string
jobs:
build-image:
name: Packer build - ${{ inputs.distrib }} - ${{ inputs.techno }} - ${{ inputs.product }}
runs-on: ubuntu-22.04
permissions:
contents: read
id-token: write
defaults:
run:
working-directory: ./packer
outputs:
image_name: ${{ steps.env.outputs.IMAGE_NAME }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create env variables
env:
VERSION: ${{ inputs.base-version }}
id: env
run: |
set -ex
BASE_VERSION=$(echo $VERSION | sed 's/\./-/g; s/_/-/g; s/+/-/g')
echo "IMAGE_NAME=${{ inputs.product }}-${BASE_VERSION}-${{ inputs.distrib }}-${{ inputs.techno }}" >> "$GITHUB_OUTPUT"
- name: Setup packer
uses: hashicorp/setup-packer@main
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-west-1
- name: Packer build image
env:
PACKER_GITHUB_API_TOKEN: ${{ secrets.PACKER_GITHUB_TOKEN }}
IMAGE_NAME: ${{ steps.env.outputs.IMAGE_NAME }}
PRODUCT: ${{ inputs.product }}
DISTRIBUTION: ${{ inputs.distrib }}
run: |
bash ../.github/scripts/aws-packer-build.sh