-
Notifications
You must be signed in to change notification settings - Fork 0
30 lines (28 loc) · 1.29 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
name: Deploy to GitHub Container Registry
on:
push:
tags: [ '*.*' ]
env:
DOCKER_IMAGE_NAME: "galera_cluster_healthcheck"
jobs:
security_scan:
uses: ./.github/workflows/security_scan.yml
build-and-publish-image:
name: Build and Publish Docker image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build
working-directory: ./app
run: |
current_version=$(echo ${{ github.ref_name }} | sed 's/\([0-9]*\.[0-9]*\).*$/\1/')
docker build -t $DOCKER_IMAGE_NAME:latest -t $DOCKER_IMAGE_NAME:$current_version .
- name: Login to GitHub Container Registry
run: echo ${{ secrets.TOKEN }} | docker login ghcr.io -u ${{ secrets.USERNAME }} --password-stdin
- name: Push Docker image to GitHub Container Registry
run: |
current_version=$(echo ${{ github.ref_name }} | sed 's/\([0-9]*\.[0-9]*\).*$/\1/')
docker tag $DOCKER_IMAGE_NAME:latest ghcr.io/${{ secrets.USERNAME }}/$DOCKER_IMAGE_NAME:latest
docker tag $DOCKER_IMAGE_NAME:$current_version ghcr.io/${{ secrets.USERNAME }}/$DOCKER_IMAGE_NAME:$current_version
docker push ghcr.io/${{ secrets.USERNAME }}/$DOCKER_IMAGE_NAME:latest
docker push ghcr.io/${{ secrets.USERNAME }}/$DOCKER_IMAGE_NAME:$current_version