Skip to content

Commit

Permalink
Split build and lint workflows into separate workflows per platform. …
Browse files Browse the repository at this point in the history
…Create a badge for each workflow. Bump runner version
  • Loading branch information
pavlovic-ivan committed Oct 9, 2022
1 parent 0abe882 commit 68ab93b
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 40 deletions.
Original file line number Diff line number Diff line change
@@ -1,32 +1,11 @@
name: Packer Build
name: Packer Build for AWS

on:
push:
branches:
- main

jobs:
build-gcp:
runs-on: ubuntu-20.04
environment: gcp
steps:
- name: Checkout Packer project
uses: actions/checkout@v3

- name: Initialize Packer Plugin Binaries:GCP
run: packer init ./gcp

- name: Build Image:GCP
env:
PKR_VAR_project: ${{ secrets.GOOGLE_PROJECT }}
GOOGLE_APPLICATION_CREDENTIALS: gcp.json
run: |
cat > $GOOGLE_APPLICATION_CREDENTIALS << EOF
${{ secrets.GOOGLE_CREDENTIALS }}
EOF
trap "rm -f $GOOGLE_APPLICATION_CREDENTIALS" EXIT
packer build -force -var-file=./gcp/amd64/values.pkrvars.hcl -var "runner_version=$(cat versions.json | jq -r '.runner')" ./gcp
build-aws:
runs-on: ubuntu-20.04
environment: aws
Expand Down
16 changes: 1 addition & 15 deletions .github/workflows/lint.yaml → .github/workflows/aws-lint.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,11 @@
name: lint
name: Packer Lint for AWS

on:
pull_request:
push:
workflow_call:

jobs:
validate-gcp:
runs-on: ubuntu-20.04
steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Initialize Packer Plugin Binaries:GCP
run: packer init ./gcp

- name: Validate Template:GCP
env:
PKR_VAR_project: dummy_value
run: packer validate -var-file=./gcp/amd64/values.pkrvars.hcl -var "runner_version=$(cat versions.json | jq -r '.runner')" ./gcp

validate-aws:
runs-on: ubuntu-20.04
strategy:
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/gcp-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Packer Build for GCP

on:
push:
branches:
- main

jobs:
build-gcp:
runs-on: ubuntu-20.04
environment: gcp
steps:
- name: Checkout Packer project
uses: actions/checkout@v3

- name: Initialize Packer Plugin Binaries:GCP
run: packer init ./gcp

- name: Build Image:GCP
env:
PKR_VAR_project: ${{ secrets.GOOGLE_PROJECT }}
GOOGLE_APPLICATION_CREDENTIALS: gcp.json
run: |
cat > $GOOGLE_APPLICATION_CREDENTIALS << EOF
${{ secrets.GOOGLE_CREDENTIALS }}
EOF
trap "rm -f $GOOGLE_APPLICATION_CREDENTIALS" EXIT
packer build -force -var-file=./gcp/amd64/values.pkrvars.hcl -var "runner_version=$(cat versions.json | jq -r '.runner')" ./gcp
21 changes: 21 additions & 0 deletions .github/workflows/gcp-lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Packer Lint for GCP

on:
pull_request:
push:
workflow_call:

jobs:
validate-gcp:
runs-on: ubuntu-20.04
steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Initialize Packer Plugin Binaries:GCP
run: packer init ./gcp

- name: Validate Template:GCP
env:
PKR_VAR_project: dummy_value
run: packer validate -var-file=./gcp/amd64/values.pkrvars.hcl -var "runner_version=$(cat versions.json | jq -r '.runner')" ./gcp
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[![Build Workflow](https://github.com/pavlovic-ivan/ephemeral-github-runner-image-gcp/actions/workflows/build.yaml/badge.svg?style=flat)](https://github.com/pavlovic-ivan/ephemeral-github-runner-image-gcp/actions)
[![lint](https://github.com/pavlovic-ivan/ephemeral-github-runner-image-gcp/actions/workflows/lint.yaml/badge.svg)](https://github.com/pavlovic-ivan/ephemeral-github-runner-image-gcp/actions)
[![GCP Build](https://github.com/pavlovic-ivan/ephemeral-github-runner-image-gcp/actions/workflows/gcp-build.yaml/badge.svg?style=flat)](https://github.com/pavlovic-ivan/ephemeral-github-runner-image/actions/workflows/gcp-build.yaml)
[![AWS Build](https://github.com/pavlovic-ivan/ephemeral-github-runner-image-gcp/actions/workflows/aws-build.yaml/badge.svg?style=flat)](https://github.com/pavlovic-ivan/ephemeral-github-runner-image/actions/workflows/aws-build.yaml)
[![GCP Lint](https://github.com/pavlovic-ivan/ephemeral-github-runner-image-gcp/actions/workflows/gcp-lint.yaml/badge.svg?style=flat)](https://github.com/pavlovic-ivan/ephemeral-github-runner-image/actions/workflows/gcp-lint.yaml)
[![AWS Lint](https://github.com/pavlovic-ivan/ephemeral-github-runner-image-gcp/actions/workflows/aws-lint.yaml/badge.svg?style=flat)](https://github.com/pavlovic-ivan/ephemeral-github-runner-image/actions/workflows/aws-lint.yaml)
[![release](https://badgen.net/github/release/pavlovic-ivan/ephemeral-github-runner-image-gcp?icon=github&color=cyan)](https://github.com/pavlovic-ivan/ephemeral-github-runner-image-gcp/releases/tag/v2.283.3)
[![releases](https://badgen.net/github/releases/pavlovic-ivan/ephemeral-github-runner-image-gcp?icon=github&color=orange)](https://github.com/pavlovic-ivan/ephemeral-github-runner-image-gcp/releases)
[![licence](https://badgen.net/github/license/pavlovic-ivan/ephemeral-github-runner-image-gcp?icon=github)](https://github.com/pavlovic-ivan/ephemeral-github-runner-image-gcp/blob/main/LICENSE.md)
Expand Down
2 changes: 1 addition & 1 deletion versions.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"runner": "v2.297.0"
"runner": "v2.298.2"
}

0 comments on commit 68ab93b

Please sign in to comment.