-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (79 loc) · 2.76 KB
/
tag-release.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
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: "Tag Release"
on:
push:
branches:
- main
- master
jobs:
build_cfg:
runs-on: ubuntu-latest
outputs:
VERSION_STR: ${{ steps.config_step.outputs.VERSION_STR }}
VERSION_INT: ${{ steps.config_step.outputs.VERSION_INT }}
ALT_TAGS: ${{ steps.config_step.outputs.ALT_TAGS }}
permissions:
contents: write
steps:
- name: "Create Version STR"
id: config_step
run: |-
VER_BUILD=$(date +%H%M)
# limit to only first 3 chars
VER_BUILD=${VER_BUILD:0:3}
# 'strict' semver segments cannot start with 0
VERSION_NUM="$(date +%y).$(date +%-m).$(date +%-d).${VER_BUILD#0}"
# recreate as INT, leaving 0's in place; creates a 'reasonable' 32-bit signed int.
VERSION_INT="$(date +%y)$(date +%m)$(date +%d)${VER_BUILD}"
echo "VERSION_INT=${VERSION_INT}" >> $GITHUB_OUTPUT
VERSION_STR=${VERSION_NUM}
ALT_TAGS=",ci-main"
echo "VERSION_STR=${VERSION_STR}" >> $GITHUB_OUTPUT
echo "ALT_TAGS=${ALT_TAGS}" >> $GITHUB_OUTPUT
echo "::notice::Version STR=${VERSION_STR}${ALT_TAGS}"
- name: "Create Release"
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.config_step.outputs.VERSION_STR }}
release_name: v${{ steps.config_step.outputs.VERSION_STR }}
generate_release_notes: true
target_commitish: ${{ github.ref_name }}
#endjob build_cfg
trigger-build:
runs-on: ubuntu-latest
needs: [build_cfg]
environment: default
env:
K8S_PROJECT: pulse-engage-mailroom
K8S_CONTAINER: mailroom
SLACK_DEPLOY_MSG:
steps:
- name: "Trigger Container Build"
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.CI_WEBHOOK_TOKEN }}
repository: istresearch/ci-docker
event-type: build-repo
client-payload: |-
{
"repo": {
"name": "${{ github.repository }}",
"ref_type": "${{ github.ref_type }}",
"ref_name": "${{ github.ref_name }}"
},
"image": {
"dockerfile": "Dockerfile",
"arch_allowed": "amd64",
"name": "${{ github.repository }}",
"tag": "${{ needs.build_cfg.outputs.VERSION_STR }}${{ needs.build_cfg.outputs.ALT_TAGS }}",
"build_args": [
]
},
"callback": {
"repository": "${{ github.repository }}",
"event_type": "build_image_result",
"error_type": "build_image_error"
}
}
#endjob trigger-build