-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild-and-deploy.yml
42 lines (39 loc) · 1.26 KB
/
build-and-deploy.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
36
37
38
39
40
41
42
name: Build and Deploy
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
- name: Build Docker image
run: |
docker build -t jsonplaceholderapi .
docker tag jsonplaceholderapi ${{ secrets.DOCKER_USERNAME }}/jsonplaceholderapi:develop
deploy:
needs: build # Indica que este trabajo depende del trabajo "build"
runs-on: ubuntu-latest
steps:
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Pull Docker image
run: docker pull ${{ secrets.DOCKER_USERNAME }}/jsonplaceholderapi:develop
- name: Log in to Render.com
run: |
curl -X POST "https://api.render.com/v1/deploys" \
-H "Authorization: Bearer ${{ secrets.RENDER_TOKEN }}" \
-d '{
"branch": "main",
"serviceId": "your-service-id",
"image": "${{ secrets.DOCKER_USERNAME }}/jsonplaceholderapi:develop"
}'