Merge pull request #7 from janpreet/refator #35
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
name: CI/CD Pipeline | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
if: false | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Cache Docker layers | |
uses: actions/cache@v2 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Log in to GitHub Container Registry | |
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.repository_owner }} --password-stdin | |
- name: Build Docker image | |
run: | | |
docker build --build-arg TERRAFORM_VERSION=1.9.3 --build-arg ANSIBLE_VERSION=10.2.0 -t ghcr.io/${{ github.repository_owner }}/kado:latest . | |
- name: Push Docker image | |
run: | | |
docker push ghcr.io/${{ github.repository_owner }}/kado:latest | |
run-kado: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Copy .kdconfig to Home Directory | |
run: | | |
mkdir -p $HOME | |
cp .kdconfig $HOME/ | |
- name: Run Kado in Docker | |
run: | | |
docker run --rm -v ${{ github.workspace }}:/workspace -v $HOME/.kdconfig:/root/.kdconfig ghcr.io/${{ github.repository_owner }}/kado:latest ai |