-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (57 loc) · 2 KB
/
docker.build.yaml
File metadata and controls
65 lines (57 loc) · 2 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
63
64
65
name: Build Docker image
on:
workflow_dispatch:
push:
branches:
- master
- develop
tags:
- 'v*.*.*'
concurrency:
group: ci-${{ github.ref }}-${{ github.head_ref }}
cancel-in-progress: true
jobs:
build:
continue-on-error: true
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[skip build]')"
outputs:
newTag: ${{ steps.latest_version.outputs.tag }}
dockerBuildResult: ${{ steps.build_image.outcome }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: extract branch name
id: branch_name
run: ref=$(echo ${{ github.ref }} | sed 's@.*/@@') && echo $ref && echo "::set-output name=ref::$ref"
- name: Bump version and push tag
uses: playtini/github-tag-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WITH_V: true
DEFAULT_BUMP: patch
SUFFIX: ${{ steps.branch_name.outputs.ref }}
- name: Determine latest tracker version
id: latest_version
uses: flownative/action-git-latest-release@v1.1.2
- name: Build Docker image
id: build_image
uses: playtini/docker-action-docker-build@master
with:
tag_ref: ${{ steps.latest_version.outputs.tag }}
image_name: ghcr.io/${{ github.repository }}
image_tag: ${{ steps.latest_version.outputs.tag }}
git_repository_url: https://github.com/${{ github.repository }}
git_sha: ${{ github.sha }}
registry_password: ${{ secrets.GITHUB_TOKEN }}
cleanUp:
runs-on: ubuntu-latest
needs: build
steps:
- name: 🌲🌳🦌🐿🌳 Remove tag becaues build failed
if: needs.build.outputs.dockerBuildResult == 'failure'
run: |
echo "Remove git tag by failure (${{ needs.build.outputs.newTag }})"
git tag -d ${{ needs.build.outputs.newTag }} && git push origin :refs/tags/${{ needs.build.outputs.newTag }}
exit 1