-
Notifications
You must be signed in to change notification settings - Fork 3
70 lines (60 loc) · 1.99 KB
/
Copy pathrelease.yml
File metadata and controls
70 lines (60 loc) · 1.99 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
60
61
62
63
64
65
66
67
68
69
70
name: Release
on:
release:
types: [published]
jobs:
release:
runs-on: ubuntu-latest
outputs:
image-tag: ${{ steps.tag.outputs.IMAGE_TAG }}
steps:
- name: Check Out Repo
uses: actions/checkout@v4
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: bezysoftware
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Get docker tag
id: tag
run: echo "IMAGE_TAG=${{ github.event.release.tag_name }}" >> $GITHUB_OUTPUT
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Build and push
id: docker_build
uses: docker/build-push-action@v6
with:
context: ./
file: ./Dockerfile.Release
builder: ${{ steps.buildx.outputs.name }}
build-args: |
APP_VERSION=${{ steps.tag.outputs.IMAGE_TAG }}
push: true
tags: bezysoftware/netstr:${{ steps.tag.outputs.IMAGE_TAG }},bezysoftware/netstr:latest
deploy:
runs-on: ubuntu-latest
needs: [ release ]
environment: prod
env:
IMAGE_TAG: ${{ needs.release.outputs.image-tag }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup SSH
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_PRIVATE_KEY }}
known_hosts: ${{ secrets.SSH_KNOWN_HOSTS }}
- name: Create docker context
run: docker context create remote --docker "host=ssh://${{ secrets.SSH_USER }}@${{ secrets.SSH_REMOTE_HOST }}"
- name: Docker compose up
run: |
docker --context remote compose pull
docker --context remote compose up -d
env:
NETSTR_DB_PASSWORD: ${{ secrets.NETSTR_DB_PASSWORD }}
NETSTR_IMAGE: "bezysoftware/netstr:${{ env.IMAGE_TAG }}"
NETSTR_ENVIRONMENT: prod
NETSTR_PORT: 8080
NETSTR_VERSION: ${{ env.IMAGE_TAG }}