-
Notifications
You must be signed in to change notification settings - Fork 14
47 lines (45 loc) · 1.53 KB
/
deploy.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
name: Deploy
on:
push:
tags:
- v*
workflow_dispatch:
jobs:
deploy:
environment:
name: ${{ (contains(github.ref, '-rc')) && 'development' || 'production' }}
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
COMMITTER: ${{ github.actor }}
DOCKER_IMAGE: ghcr.io/hackthebox/hackster:${{ github.sha }}
LATEST_IMAGE: ghcr.io/hackthebox/hackster:latest
CHANGE_CAUSE: ${{ github.run_number }}-${{ github.sha }}
DEPLOYMENT_NAME: ${{ (contains(github.ref, '-rc')) && 'hackster-dev' || 'hackster' }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build image
uses: docker/build-push-action@v5
with:
push: true
context: .
tags: ${{ env.DOCKER_IMAGE }},${{ env.LATEST_IMAGE }}
- name: Rollout release
uses: makelarisjr/kubectl-action@v1
with:
config: ${{ secrets.KUBE_CONFIG_DATA }}
command: |
set image deployment ${{ env.DEPLOYMENT_NAME }} hackster=${{ env.DOCKER_IMAGE }};
kubectl annotate deployment ${{ env.DEPLOYMENT_NAME }} kubernetes.io/change-cause="${{ env.CHANGE_CAUSE }}";