-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (49 loc) · 1.54 KB
/
Copy pathdockerpush.yml
File metadata and controls
59 lines (49 loc) · 1.54 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: Publish Docker image
on:
push:
branches: [master]
env:
CURRENT_TAG: v1.${{ github.run_number }}.0
jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Setup .env from secrets
run: echo "${{ secrets.PROD_DOTENV }}" | base64 -d > .env
- name: Log in to Docker Hub
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build images
run: docker-compose build
- name: Push images to Docker Hub
run: docker-compose push
server_update:
name: Update server to latest tag
runs-on: ubuntu-latest
needs: push_to_registry
steps:
- name: Execute SSH commmands on remote server
uses: JimCronqvist/action-ssh@master
with:
hosts: ${{ secrets.SSH_HOST }}
privateKey: ${{ secrets.SSH_KEY }}
command: |
echo CURRENT_TAG=${{ env.CURRENT_TAG }} > /home/ec2-user/larabrute/.env
bash /home/ec2-user/update_larabrute.sh
release-app:
name: Release App
runs-on: ubuntu-latest
steps:
- name: Create GH release
id: creates_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.CURRENT_TAG }}
release_name: ${{ env.CURRENT_TAG }}