rnbrown submitted a CI CD Action #7
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: Continuous Integration and Continuous Deployment Using Ansible/Kubernetes | |
run-name: ${{ github.actor }} submitted a CI CD Action | |
on: | |
push: | |
branches: [ "main" ] | |
jobs: | |
Explore-GitHub-Actions: | |
if: contains(github.event.head_commit.message, '/run-') | |
runs-on: ubuntu-latest | |
steps: | |
- run: echo "Comment ${{ github.event.head_commit.message }}" | |
- run: echo "Job was automatically triggered by a ${{ github.event_name }} event." | |
- run: echo "Job is now running on a ${{ runner.os }} server hosted by GitHub!" | |
- run: echo "Branch is ${{ github.ref }} and your repository is ${{ github.repository }}." | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- id: 'auth' | |
uses: google-github-actions/auth@v1 | |
with: | |
credentials_json: '${{ secrets.DEPLOYMENT }}' | |
- name: Configure Google Cloud SDK | |
uses: google-github-actions/setup-gcloud@v1 | |
- name: Configure Docker Client | |
run: | | |
curl -fsSL https://get.docker.com -o get-docker.sh | |
sh get-docker.sh | |
- name: Create secrets directory | |
run: | | |
mkdir ${{ github.workspace }}/secrets | |
chmod 0777 secrets | |
- name: Create secrets file | |
run: | | |
echo '${{ secrets.DEPLOYMENT }}' > ${{ github.workspace }}/secrets/deployment.json | |
echo '${{ secrets.DEPLOYMENT }}' > ${{ github.workspace }}/secrets/gcp-service.json | |
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." | |
- run: echo "🖥️ The workflow is now ready to test your code on the runner." | |
- name: List files in the repository | |
run: | | |
ls ${{ github.workspace }} | |
- name: Build Deployment Container | |
run: | | |
cd ${{ github.workspace }}/app/src/deployment/ | |
sh docker-shell.sh | |