Skip to content

Commit

Permalink
Trying a prebuilt workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
kenlight-bu committed Sep 27, 2024
1 parent 439be22 commit 157214d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 52 deletions.
61 changes: 11 additions & 50 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,56 +1,17 @@
# Your workflow name.
name: Deploy to heroku.

# Run workflow on every push to dev branch
on:
push:
branches: HW-166-add-tests-to-docker-container
# Your workflows jobs.
name: 'peak-performance' #set whatevername you want to your github job
on: {} # set the events you would like to trigger this job
jobs:
build:
runs-on: ubuntu-latest
steps:
# Check-out your repository.
- name: Checkout
uses: actions/checkout@v2

# Copy heroku.yml to the root directory
#Trying to get this file to change so I can make a commit
- name: Copy heroku.yml to root
run: cp ./code/heroku.yml ./

# Set up Docker Buildx (optional, but recommended for multi-platform builds)
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

# Install Docker Compose
- name: Install Docker Compose
run: |
sudo apt-get update
sudo apt-get install docker-compose -y
# Log in to Docker Hub (if needed, otherwise skip this step)
- name: Log in to Heroku Container Registry
run: echo "${{ secrets.HEROKU_API_KEY }}" | docker login --username=__token__ --password-stdin registry.heroku.com

# Build and tag Docker images using docker-compose.
- name: Build and Tag Docker Images with Docker Compose
run: |
docker-compose -f ./code/docker-compose-production.yml build
# Tag the Docker images for Heroku
- name: Tag Docker Images
run: |
docker tag registry.heroku.com/peak-performace/api-production:latest registry.heroku.com/${{ secrets.HEROKU_APP_NAME }}/api-production:latest
docker tag registry.heroku.com/peak-performace/client-production:latest registry.heroku.com/${{ secrets.HEROKU_APP_NAME }}/client-production:latest
# Push Docker images to Heroku Container Registry.
- name: Push Docker Images to Heroku
run: |
docker push registry.heroku.com/${{ secrets.HEROKU_APP_NAME }}/api-production:latest
docker push registry.heroku.com/${{ secrets.HEROKU_APP_NAME }}/client-production:latest
# Release the Docker images on Heroku.
- name: Release Docker Images on Heroku
run: |
heroku container:release api client --app ${{ secrets.HEROKU_APP_NAME }}
- name: Build, Push and Deploy to Heroku #set the whatever name you want to this step
id: heroku
uses: snithyanantham/[email protected] # use the latest version of the action
with:
app_name: "peak-performace"
email: ${{ secrets.HEROKU_EMAIL }} # your heroku email
api_key: ${{ secrets.HEROKU_API_KEY }} # your heroku api key
docker_compose_file: './code/docker-compose-production.yml' # set the path to the folder where the docker-compose file is located
heroku_apps: '[{"imagename":"api-production","appname":"peak-performace","apptype":"web"},{"imagename":"client-production","appname":"peak-performance","apptype":"web"}]' # List of Docker Image name, Heroku app and Heroku app type
4 changes: 2 additions & 2 deletions code/docker-compose-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ services:
context: .
dockerfile: ./client/Dockerfile.production
env_file: ./.env.production
image: registry.heroku.com/peak-performace/api-production:latest # Use Heroku registry format
image: api-production:latest # Use Heroku registry format
restart: unless-stopped
ports:
- "5000:5000"
Expand All @@ -18,7 +18,7 @@ services:
context: .
dockerfile: ./server/Dockerfile.production
env_file: ./.env.production
image: registry.heroku.com/peak-performace/client-production:latest # Use Heroku registry format
image: client-production:latest # Use Heroku registry format
restart: unless-stopped
networks:
- peak-performance
Expand Down

0 comments on commit 157214d

Please sign in to comment.