Skip to content

Commit

Permalink
[build][feat] allow dynamic specify the external resizer name via the…
Browse files Browse the repository at this point in the history
… flag
  • Loading branch information
cuongpiger committed May 25, 2024
1 parent 10d54fc commit face55b
Show file tree
Hide file tree
Showing 3 changed files with 219 additions and 0 deletions.
126 changes: 126 additions & 0 deletions .github/workflows/build_prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
name: Package vngcloud-csi-volume-modifier into container image on MAIN branch

on:
push:
tags:
- 'v*'
pull_request:
tags:
- 'v*'

jobs:
package-image:
runs-on: ubuntu-latest
environment:
name: prod # Set the environment name
if: contains(github.event.head_commit.message, '[build]')
steps:
- name: Send alert that a new commit has been created
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
format: markdown
message: |
🚀 *[PROD] NEW COMMIT*
*Repository*: `${{ github.repository }}`
*Author*: `${{ github.actor }}`
*Action*: Building `vngcloud-csi-volume-modifier` image
*Commit message*:
```
${{ github.event.commits[0].message }}
```
*See changes*: https://github.com/${{ github.repository }}/commit/${{github.sha}}
*See workflow*: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
- uses: actions/checkout@v4
- name: Login to VngCloud Registry
uses: docker/login-action@v3
with:
registry: ${{ secrets.VCR_REGISTRY }}
username: ${{ secrets.VCR_USERNAME }}
password: ${{ secrets.VCR_PASSWORD }}
- name: Build vngcloud-csi-volume-modifier image
continue-on-error: true
run: |
export REGISTRY=${{ secrets.VCR_REGISTRY }}
export VERSION=${{ github.ref_name }}
make docker-build
echo "VERSION=${VERSION}" >> $GITHUB_ENV
- name: Send alert that the image has been built failed
uses: appleboy/telegram-action@master
if: ${{ failure() }}
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
format: markdown
message: |
⛔ *[PROD] ERROR*
*Repository*: `${{ github.repository }}`
*Author*: `${{ github.actor }}`
*Action*: Failed to build `vngcloud-csi-volume-modifier` image
*Commit message*:
```
${{ github.event.commits[0].message }}
```
*See changes*: https://github.com/${{ github.repository }}/commit/${{github.sha}}
*See workflow*: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
- name: Send alert that the image has been built success
uses: appleboy/telegram-action@master
if: ${{ success() }}
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
format: markdown
message: |
📦 *[PROD] SUCCESS*
*Repository*: `${{ github.repository }}`
*Author*: `${{ github.actor }}`
*Action*: The `vngcloud-csi-volume-modifier:${{ env.VERSION }}` image is built successfully, try to push it to VngCloud Registry
*Commit message*:
```
${{ github.event.commits[0].message }}
```
*See changes*: https://github.com/${{ github.repository }}/commit/${{github.sha}}
*See workflow*: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
- name: Push vngcloud-csi-volume-modifier image
continue-on-error: true
run: |
export REGISTRY=${{ secrets.VCR_REGISTRY }}
export VERSION=$VERSION
make docker-push
- name: Send alert that the image has been pushed failed
uses: appleboy/telegram-action@master
if: ${{ failure() }}
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
format: markdown
message: |
⛔ *[PROD] ERROR*
*Repository*: `${{ github.repository }}`
*Author*: `${{ github.actor }}`
*Action*: Failed to PUSH `vngcloud-csi-volume-modifier` image to VngCloud registry
*Commit message*:
```
${{ github.event.commits[0].message }}
```
*See changes*: https://github.com/${{ github.repository }}/commit/${{github.sha}}
*See workflow*: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
- name: Send alert that the image has been pushed success
uses: appleboy/telegram-action@master
if: ${{ success() }}
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
format: markdown
message: |
🛸 *[PROD] SUCCESS*
*Repository*: `${{ github.repository }}`
*Author*: `${{ github.actor }}`
*Action*: The `vngcloud-csi-volume-modifier:${{ env.VERSION }}` image is pushed successfully to VngCloud registry
*Commit message*:
```
${{ github.event.commits[0].message }}
```
*See changes*: https://github.com/${{ github.repository }}/commit/${{github.sha}}
*See workflow*: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
90 changes: 90 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Release vngcloud-csi-volume-modifier project

on:
push:
tags:
- 'v*'
pull_request:
tags:
- 'v*'

jobs:
build:
name: GoReleaser build
runs-on: ubuntu-latest

steps:
- name: Send alert that a new release has been created
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
format: markdown
message: |
🚀 *[RELEASE] NEW RELEASE*
*Repository*: `${{ github.repository }}`
*Author*: `${{ github.actor }}`
*Action*: Building `vngcloud-csi-volume-modifier:${{ github.ref_name }}` application
*Commit message*:
```text
${{ github.event.commits[0].message }}
```
*See changes*: https://github.com/${{ github.repository }}/commit/${{github.sha}}
*See workflow*: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
- name: Check out code into the Go module directory
uses: actions/checkout@v4
with:
fetch-depth: 0 # See: https://goreleaser.com/ci/actions/

- name: Set up Go 1.22
uses: actions/setup-go@v4
continue-on-error: true
with:
go-version: 1.22
id: go

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
continue-on-error: true
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GO_RELEASER_GITHUB_TOKEN }}
- name: Send alert that the image has been built failed
uses: appleboy/telegram-action@master
if: ${{ failure() }}
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
format: markdown
message: |
⛔ *[RELEASE] ERROR*
*Repository*: `${{ github.repository }}`
*Author*: `${{ github.actor }}`
*Action*: Failed to release `vngcloud-csi-volume-modifier:${{ github.ref_name }}` application
*Commit message*:
```text
${{ github.event.commits[0].message }}
```
*See changes*: https://github.com/${{ github.repository }}/commit/${{github.sha}}
*See workflow*: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
- name: Send alert that the image has been built success
uses: appleboy/telegram-action@master
if: ${{ success() }}
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
format: markdown
message: |
📦 *[RELEASE] SUCCESS*
*Repository*: `${{ github.repository }}`
*Author*: `${{ github.actor }}`
*Action*: The `vngcloud-csi-volume-modifier:${{ github.ref_name }}` application is built successfully
*Commit message*:
```text
${{ github.event.commits[0].message }}
```
*See changes*: https://github.com/${{ github.repository }}/commit/${{github.sha}}
*See workflow*: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
3 changes: 3 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# .goreleaser.yaml
builds:
- skip: true

0 comments on commit face55b

Please sign in to comment.