From 659bb68d56bf0bc9118275a9c4be54327ce381f8 Mon Sep 17 00:00:00 2001
From: Sudhish <108091997+skrdgraph@users.noreply.github.com>
Date: Mon, 27 Feb 2023 21:47:06 +0000
Subject: [PATCH] chore(cd): tag based deployments (#1887)
## Problem
issue example ->
Needs a better standardization
## Solution
solution example ->
Migrating to this model
---
.github/workflows/cd-badger.yml | 32 +++++++++++++++++++++-----------
1 file changed, 21 insertions(+), 11 deletions(-)
diff --git a/.github/workflows/cd-badger.yml b/.github/workflows/cd-badger.yml
index 36b392c..930fec9 100644
--- a/.github/workflows/cd-badger.yml
+++ b/.github/workflows/cd-badger.yml
@@ -1,10 +1,18 @@
name: cd-badger
-on: workflow_dispatch
+on:
+ workflow_dispatch:
+ inputs:
+ releasetag:
+ description: 'releasetag'
+ required: true
+ type: string
jobs:
badger-build-amd64:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
+ with:
+ ref: '${{ github.event.inputs.releasetag }}'
- name: Get Go Version
run: |
#!/bin/bash
@@ -17,15 +25,15 @@ jobs:
- name: Set Badger Release Version
run: |
#!/bin/bash
- GIT_BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
- if [[ "$GIT_BRANCH_NAME" == "release/v"* ]];
+ GIT_TAG_NAME='${{ github.event.inputs.releasetag }}'
+ if [[ "$GIT_TAG_NAME" == "v"* ]];
then
- echo "this is a release branch"
+ echo "this is a release tag"
else
- echo "this is NOT a release branch"
+ echo "this is NOT a release tag"
exit 1
fi
- BADGER_RELEASE_VERSION=$(git rev-parse --abbrev-ref HEAD | sed 's/release\///')
+ BADGER_RELEASE_VERSION='${{ github.event.inputs.releasetag }}'
echo "making a new release for "$BADGER_RELEASE_VERSION
echo "BADGER_RELEASE_VERSION=$BADGER_RELEASE_VERSION" >> $GITHUB_ENV
- name: Fetch dependencies
@@ -46,6 +54,8 @@ jobs:
runs-on: [self-hosted, ARM64]
steps:
- uses: actions/checkout@v3
+ with:
+ ref: '${{ github.event.inputs.releasetag }}'
- name: Get Go Version
run: |
#!/bin/bash
@@ -58,15 +68,15 @@ jobs:
- name: Set Badger Release Version
run: |
#!/bin/bash
- GIT_BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
- if [[ "$GIT_BRANCH_NAME" == "release/v"* ]];
+ GIT_TAG_NAME='${{ github.event.inputs.releasetag }}'
+ if [[ "$GIT_TAG_NAME" == "v"* ]];
then
- echo "this is a release branch"
+ echo "this is a release tag"
else
- echo "this is NOT a release branch"
+ echo "this is NOT a release tag"
exit 1
fi
- BADGER_RELEASE_VERSION=$(git rev-parse --abbrev-ref HEAD | sed 's/release\///')
+ BADGER_RELEASE_VERSION='${{ github.event.inputs.releasetag }}'
echo "making a new release for "$BADGER_RELEASE_VERSION
echo "BADGER_RELEASE_VERSION=$BADGER_RELEASE_VERSION" >> $GITHUB_ENV
- name: Fetch dependencies