-
Notifications
You must be signed in to change notification settings - Fork 3
62 lines (62 loc) · 2.09 KB
/
release.yml
File metadata and controls
62 lines (62 loc) · 2.09 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
55
56
57
58
59
60
61
62
name: "Release new version"
on:
workflow_run:
workflows:
- "CI Tests"
branches:
- master
types:
- completed
jobs:
docker:
name: "Build Docker container"
runs-on: ubuntu-22.04
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: "Get CAPIO version"
run: echo "CAPIO_VERSION=$(cat CMakeLists.txt | grep " VERSION" | awk '{print $2}')" >> $GITHUB_ENV
- name: "Check if Docker image already exists"
run: echo "NEW_IMAGE=$(docker buildx imagetools inspect alphaunito/capio:${CAPIO_VERSION} > /dev/null 2>&1; echo $?)" >> $GITHUB_ENV
- name: "Build Docker image"
if: ${{ env.NEW_IMAGE == 1 }}
uses: docker/build-push-action@v5
with:
build-args: |
CMAKE_BUILD_TYPE=Release
push: true
tags: |
alphaunito/capio:${{ env.CAPIO_VERSION }}
alphaunito/capio:latest
github:
name: "Create GitHub Release"
runs-on: ubuntu-22.04
permissions:
contents: write
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- uses: actions/checkout@v4
- name: "Get CAPIO version"
run: echo "CAPIO_VERSION=$(cat CMakeLists.txt | grep " VERSION" | awk '{print $2}')" >> $GITHUB_ENV
- name: "Check tag existence"
uses: mukunku/tag-exists-action@v1.6.0
id: check-tag
with:
tag: ${{ env.CAPIO_VERSION }}
- name: "Create Release"
id: create-release
uses: actions/create-release@v1
if: ${{ steps.check-tag.outputs.exists == 'false' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.CAPIO_VERSION }}
release_name: ${{ env.CAPIO_VERSION }}
draft: false
prerelease: false