-
Notifications
You must be signed in to change notification settings - Fork 29
68 lines (60 loc) · 1.54 KB
/
pipeline.yaml
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
60
61
62
63
64
65
66
67
68
name: pipeline
on:
push:
branches:
- "main"
permissions:
packages: write
jobs:
run-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.23.x'
- name: Install dependencies
run: go get .
- name: Test with the Go CLI
run: go test ./...
build-and-push-image:
runs-on: ubuntu-latest
needs:
- run-tests
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: https://ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: |
ghcr.io/dreamsofcode-io/zenstats:latest
ghcr.io/dreamsofcode-io/zenstats:${{ github.sha }}
deploy:
runs-on: ubuntu-latest
needs:
- build-and-push-image
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: create env file
run: |
echo "GIT_COMMIT_HASH=${{ github.sha }}" >> ./envfile
- name: Docker Stack Deploy
uses: cssnr/stack-deploy-action@v1
with:
name: zenfulstats
file: docker-stack.yaml
host: zenful.site
user: deploy
ssh_key: ${{ secrets.DEPLOY_SSH_PRIVATE_KEY }}
env_file: ./envfile