forked from Sefaria/Sefaria-Project
-
Notifications
You must be signed in to change notification settings - Fork 1
35 lines (26 loc) · 1.35 KB
/
docker-image.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
name: Docker Publish Trigger
on:
push:
branches:
- production-master # Change this to your main branch name, e.g., master
jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Login to GitHub Container Registry
run: echo ${{ secrets.PECHA_TOKEN }} | docker login ghcr.io -u ${{ github.repository_owner }} --password-stdin
- name: Set Env Variables in lowecase
run: |
echo "OWNER_LC=${OWNER,,}" >> ${GITHUB_ENV}
echo "REPOSITORY_LC=${REPOSITORY,,}" >> ${GITHUB_ENV}
env:
OWNER: '${{ github.repository_owner }}'
REPOSITORY: '${{ github.repository }}'
- name: Build Docker image
run: docker build -t ghcr.io/${{ env.OWNER_LC }}/${{ env.REPOSITORY_LC }}:${{ github.sha }} . && docker tag ghcr.io/${{ env.OWNER_LC }}/${{ env.REPOSITORY_LC }}:${{ github.sha }} ghcr.io/${{ env.OWNER_LC }}/${{ env.REPOSITORY_LC }}:latest
- name: Push Docker image
run: docker push ghcr.io/${{ env.OWNER_LC }}/${{ env.REPOSITORY_LC }}:${{ github.sha }} && docker push ghcr.io/${{ env.OWNER_LC }}/${{ env.REPOSITORY_LC }}:latest
- name: Deploy to render
run: curl -X POST ${{ secrets.DEPLOY_HOOK_NOTIFICATION }}ghcr.io/${{ env.OWNER_LC }}/${{ env.REPOSITORY_LC }}:${{ github.sha }}