-
Notifications
You must be signed in to change notification settings - Fork 20
54 lines (52 loc) · 2.01 KB
/
deploy.yaml
File metadata and controls
54 lines (52 loc) · 2.01 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
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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
- name: Derive git version
id: git-version
run: echo "value=$(git describe --tags --always --dirty)" >> "$GITHUB_OUTPUT"
- name: Login to ghcr.io
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build image
uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0
with:
push: true
context: .
tags: ${{ env.DOCKER_IMAGE }},${{ env.LATEST_IMAGE }}
build-args: |
VERSION=${{ steps.git-version.outputs.value }}
- name: Rollout release
uses: makelarisjr/kubectl-action@6a140d582feb88b20e91ee8e35d15c255865ab32 # 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 }}";