-
Notifications
You must be signed in to change notification settings - Fork 1
40 lines (32 loc) · 1.11 KB
/
CD.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
name: CD
on:
release:
types: [published]
env:
REGISTRY: ghcr.io
IMAGE_NAME: antiz96/ankama-launcher
jobs:
Build:
runs-on:
- self-hosted
- CI-CD
steps:
- name: Clone repo
uses: actions/checkout@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.PUSH_CONTAINER_TOKEN }}
- name: Get latest tag (and remove the "v" prefix from it)
run: echo "TAG=$(git describe --abbrev=0 --tags | sed "s/v//g")" >> $GITHUB_OUTPUT
id: version
- name: Build container
run: docker build -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.TAG }} .
- name: Push container
run: |
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.TAG }}
- name: Cleanup docker images
run: docker image prune -af