Skip to content

Commit

Permalink
feat: add more workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
djnovin committed Jan 15, 2025
1 parent 1a7467a commit 1d29d6b
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 3 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/go.yml → .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go

name: Go
name: Build and Test

on:
push:
branches: ["main"]
pull_request:
branches: ["main"]

jobs:
build:
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Docker Build and Push

on:
workflow_run:
workflows: ["Build and Test"]
types:
- completed

jobs:
docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ap-southeast-2

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2

- name: Build Docker image
run: |
REPO_URI=${{ steps.login-ecr.outputs.registry }}/droneshield
docker build -t $REPO_URI:${{ github.sha::8 }} .
- name: Push Docker image
run: |
REPO_URI=${{ steps.login-ecr.outputs.registry }}/droneshield
docker push $REPO_URI:${{ github.sha::8 }}
22 changes: 22 additions & 0 deletions .github/workflows/terraform.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Terraform Validation

on:
pull_request:
branches:
- main

jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Terraform
uses: hashicorp/setup-terraform@v2
with:
terraform_version: 1.4.0
- name: Terraform Init
run: terraform init
working-directory: ./infra
- name: Terraform Validate
run: terraform validate
working-directory: ./infra
25 changes: 25 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# If you prefer the allow list template instead of the deny list, see community template:
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
#
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
# vendor/

# Go workspace file
go.work
go.work.sum

# env file
.env

0 comments on commit 1d29d6b

Please sign in to comment.