-
Notifications
You must be signed in to change notification settings - Fork 4
61 lines (59 loc) · 2.11 KB
/
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
name: Deploy
on:
push:
tags:
- 'v*'
jobs:
backend:
name: Backend
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set Deployment Options
id: deployment
run: |
case "$GITHUB_REF" in
refs/tags/v*)
VERSION="${GITHUB_REF:11}"
MAJOR="${GITHUB_REF:11:1}"
;;
esac
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "major=$MAJOR" >> "$GITHUB_OUTPUT"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: ${{ secrets.DOCKER_REGISTRY }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: |
${{ secrets.DOCKER_REGISTRY }}/stp/server-24:${{ steps.deployment.outputs.version }}
${{ secrets.DOCKER_REGISTRY }}/stp/server-24:${{ steps.deployment.outputs.major }}
cache-to: type=gha,mode=max
cache-from: type=gha
- name: Rancher Deploy
uses: sekassel-research/actions-rancher-update@v3.0.0
with:
rancher_url: ${{ secrets.RANCHER_URL }}
rancher_token: ${{ secrets.RANCHER_TOKEN }}
cluster_id: ${{ secrets.CLUSTER_ID }}
project_id: ${{ secrets.PROJECT_ID }}
namespace: ${{ secrets.NAMESPACE }}
deployment: ${{ secrets.DEPLOYMENT }}-v${{ steps.deployment.outputs.major }}
docker_image: ${{ secrets.DOCKER_REGISTRY }}/stp/server-24:${{ steps.deployment.outputs.version }}
- name: Discord Notification
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
uses: Ilshidur/action-discord@master
with:
args: |
Eine neue Serverversion ist verfügbar: `${{ steps.deployment.outputs.version }}`
<https://stpellar.uniks.de/api/v${{ steps.deployment.outputs.major }}>