-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (47 loc) · 1.65 KB
/
build-dev.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
43
44
45
46
47
48
49
50
51
52
53
54
name: Build www-dev
on:
push:
branches:
- dev
paths:
- 'src/*'
- 'stack/*'
jobs:
build:
name: Continuous delivery of www-dev
runs-on: ubuntu-latest
steps:
- name: Checkout source files
uses: actions/checkout@v1
- name: Build docker image
run: |
docker build ./src --file ./src/Dockerfile \
--tag docker.pkg.github.com/team-gsri/homepage/homepage:$(date +%s) \
--tag docker.pkg.github.com/team-gsri/homepage/homepage:git-$(git rev-parse --short "$GITHUB_SHA") \
--tag docker.pkg.github.com/team-gsri/homepage/homepage:dev
- name: Push docker image
run: |
docker login docker.pkg.github.com --username team-gsri --password ${{ secrets.GITHUB_TOKEN }}
docker push docker.pkg.github.com/team-gsri/homepage/homepage
- name: Copy stack file
uses: appleboy/scp-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_KEY }}
source: "./stack/*"
target: "~/stacks/homepage-dev"
overwrite: true
rm: true
strip_components: 1
- name: Redeploy stack on swarm
uses: appleboy/ssh-action@master
env:
GITHUB_USERNAME: team-gsri
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_KEY }}
envs: GITHUB_USERNAME,GITHUB_TOKEN
script: /opt/docker-tools-master/docker-stack-deploy.sh homepage-dev