Mock deploy workflow #33
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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: Mock deploy workflow | |
on: | |
push: | |
branches: [ "master" ] | |
#pull_request: | |
# branches: [ "master" ] | |
workflow_dispatch: | |
inputs: | |
deployment_type: | |
description: 'Type of deployment' | |
required: true | |
default: "Development" | |
type: choice | |
options: | |
- Development | |
- Test | |
- Staging | |
- Production | |
env: | |
LOG_LEVEL: | | |
${{ fromJson('{ Development: "DEBUG", Production: "INFO" }')[github.event.inputs.deployment_type] }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.20' | |
- name: Build | |
run: echo 'Build some stuff' | |
- name: Test | |
run: echo 'Testing some stuff' | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build | |
environment: ${{ github.event.inputs.deployment_type || 'Development' }} | |
steps: | |
- name: Output deploy type | |
run: echo 'Deploy type';echo '${{ github.event.inputs.deployment_type || 'Development' }}' | |
- name: Mock environmment deploy | |
run: echo "Deploy to ${{ vars.ACCOUNT_ID }} with log level $LOG_LEVEL. Shhh the secret is ${{ secrets.SECRET_PASSWORD_TEST }} (GitHub obsfucates this)" | |
test: | |
runs-on: ubuntu-latest | |
services: | |
docker: | |
image: docker:dind | |
options: --privileged --shm-size=2g | |
volumes: | |
- /var/run/docker.sock:/var/run/docker.sock:ro | |
container: | |
image: ubuntu:latest | |
steps: | |
- name: Install Docker | |
run: | | |
apt-get update | |
apt-get install -y docker.io | |
- name: Test Docker | |
run: | | |
docker version | |
docker info | |
- uses: actions/checkout@v4 | |
- name: Build and Run Docker | |
run: | | |
ls -la | |
docker build -t aws-mfa . | |
docker run aws-mfa |