Skip to content

Commit 96a4691

Browse files
authored
Merge pull request #85 from AptFox/move-container-to-ghcr
Updated deploy action to push image to GHCR
2 parents 4ad8a8b + 963445e commit 96a4691

3 files changed

Lines changed: 51 additions & 35 deletions

File tree

.github/pull_request_template.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#### Issue: # <!-- put the issue number here -->
2+
3+
#### Summary
4+
5+
<!-- Briefly describe your changes here -->
6+
<!-- Ex:
7+
* Fixed the issue where team schedules are shifted backward.
8+
* Polished dashboard loading states.
9+
* Refactored API client tests.
10+
-->
11+
12+
- [YOUR SUMMARY HERE]
13+
14+
<!-- Sometimes it helps to summarize your commits instead. If that's the case, use the command below. -->
15+
<!-- git log origin/dev..HEAD --no-merges --pretty=format:"* %h - %an: %s (%ar)" -->
16+
17+
#### Checklist
18+
19+
- [ ] I linked to an issue with 'Issue: #'
20+
- [ ] I tested this manually
21+
- [ ] I added unit tests
22+
- [ ] I made sure all tests pass locally

.github/workflows/prod-deploy.yml

Lines changed: 28 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ on:
55
branches:
66
- main
77

8+
permissions:
9+
contents: read
10+
packages: write
11+
812
jobs:
913
deploy:
1014
runs-on: ubuntu-latest
@@ -14,38 +18,28 @@ jobs:
1418
- name: Checkout code
1519
uses: actions/checkout@v3
1620

17-
# Log in to Heroku Container Registry
18-
- name: Log in to Heroku Container Registry
21+
# Log in to GHCR
22+
- name: Log in to GHCR
23+
uses: docker/login-action@v3
24+
with:
25+
registry: ghcr.io
26+
username: ${{ github.actor }}
27+
password: ${{ secrets.GITHUB_TOKEN }}
28+
29+
# Build image
30+
- name: Build new container image
31+
run: docker build -t ${{ vars.IMAGE_NAME }}:latest .
32+
33+
# Push image
34+
- name: Push image
35+
run: docker push ${{ vars.IMAGE_NAME }}:latest
36+
37+
# Trigger deploy on VPS (web hook)
38+
- name: Trigger prod deployment
39+
if: success() # Only runs if previous steps succeeded
1940
run: |
20-
echo "${{ secrets.HEROKU_AUTH_TOKEN }}" | docker login --username=_ --password-stdin registry.heroku.com
21-
22-
# Build the Docker image
23-
- name: Build new Docker image
24-
run: docker build -t registry.heroku.com/$HEROKU_APP_NAME/web .
25-
env:
26-
HEROKU_APP_NAME: ${{ secrets.HEROKU_APP_NAME }}
27-
28-
# Push the Docker image to Heroku
29-
- name: Push new Docker image to Heroku
30-
run: docker push registry.heroku.com/$HEROKU_APP_NAME/web
31-
env:
32-
HEROKU_APP_NAME: ${{ secrets.HEROKU_APP_NAME }}
33-
34-
# Install Heroku CLI
35-
- name: Install Heroku CLI
36-
run: curl https://cli-assets.heroku.com/install.sh | sh
37-
38-
# Authenticate with Heroku using the Heroku API key (GitHub secret)
39-
- name: Login to Heroku
40-
run: heroku container:login
41-
env:
42-
HEROKU_API_KEY: ${{ secrets.HEROKU_AUTH_TOKEN }}
43-
HEROKU_HEADERS: ${{ vars.HEROKU_HEADERS }}
44-
45-
# Trigger Heroku deploy
46-
- name: Deploy the updated container on Heroku
47-
run: heroku container:release web -a harmony-backend
48-
env:
49-
HEROKU_APP_NAME: ${{ secrets.HEROKU_APP_NAME }}
50-
HEROKU_API_KEY: ${{ secrets.HEROKU_AUTH_TOKEN }}
51-
HEROKU_HEADERS: ${{ vars.HEROKU_HEADERS }}
41+
curl -X 'POST' "${{ secrets.PROD_DEPLOY_WEB_HOOK_URL }}" \
42+
-H 'accept: application/json' \
43+
-H "Content-Type: application/json" \
44+
-H "x-api-key: ${{ secrets.API_KEY }}" \
45+
-d "{ \"applicationId\": \"${{ secrets.APP_ID }}\" }"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
- Commit linted changes
2828
- Open PR against dev branch
2929
- Request to have dev merged to main for deployment of new feature
30-
- PR's merged to `main` trigger CI/CD (deployment to heroku)
30+
- PR's merged to `main` trigger CI/CD (deployment to prod)
3131

3232
# Database changes
3333
- If you're creating/updating a table, make sure to add a flyway migration script

0 commit comments

Comments
 (0)