Skip to content

Commit

Permalink
gha: auto-tag-release. [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
baracudda committed Feb 12, 2024
1 parent 1f0c230 commit 40bb9c9
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
outputs:
VERSION_STR: ${{ steps.config_step.outputs.VERSION_STR }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: "Determine Version"
id: config_step
Expand All @@ -35,7 +35,7 @@ jobs:
SLACK_DEPLOY_MSG:
steps:
- name: "Trigger Container Build"
uses: peter-evans/repository-dispatch@v2
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.CI_WEBHOOK_TOKEN }}
repository: istresearch/ci-docker
Expand Down
80 changes: 80 additions & 0 deletions .github/workflows/tag-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: "Tag Release"

on:
push:
branches:
- main
- master

jobs:
build_cfg:
runs-on: ubuntu-latest
outputs:
VERSION_STR: ${{ steps.config_step.outputs.VERSION_STR }}
permissions:
contents: write
steps:
- uses: actions/checkout@v4

- name: "Create Version STR"
id: config_step
run: |-
VER_BUILD=$(date +%-H%M)
VERSION_STR="v$(date +%y).$(date +%-m).$(date +%-d)-${VER_BUILD:0:3}"
echo "VERSION_STR=${VERSION_STR}" >> $GITHUB_OUTPUT
echo "::notice::Version STR=${VERSION_STR}"
- name: "Create Release"
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.config_step.outputs.VERSION_STR }}
release_name: ${{ 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-courier
K8S_CONTAINER: courier
SLACK_DEPLOY_MSG:
steps:
- name: "Trigger Container Build"
uses: peter-evans/repository-dispatch@v3
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 arm64",
"name": "${{ github.repository }}",
"version": "${{ needs.build_cfg.outputs.VERSION_STR }}",
"build_args": [
]
},
"deployment": {
"deploy_flag": "${{ github.ref_type == 'branch' }}",
"k8s_project": "${{ env.K8S_PROJECT }}",
"k8s_container": "${{ env.K8S_CONTAINER }}",
"deploy_msg": "${{ env.SLACK_DEPLOY_MSG }}"
},
"callback": {
"repository": "${{ github.repository }}",
"event_type": "build_image_result",
"error_type": "build_image_error"
}
}
#endjob trigger-build

0 comments on commit 40bb9c9

Please sign in to comment.