Skip to content

Commit

Permalink
ci: fix build_and_push and release workflows (#213)
Browse files Browse the repository at this point in the history
Signed-off-by: Niladri Halder <[email protected]>
  • Loading branch information
niladrih authored Nov 7, 2024
1 parent 6e3659d commit f0f4acc
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 10 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/build_and_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ jobs:
runs-on: ubuntu-latest
needs: ['integration-test']
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Go 1.19
uses: actions/setup-go@v5
with:
Expand All @@ -125,6 +128,8 @@ jobs:
- name: Set CI Tag
run: |
BRANCH=${{ github.ref_name }}
echo "BRANCH=$BRANCH" >> $GITHUB_ENV
CI_TAG=$(awk -F': ' '/^version:/ {print $2}' deploy/helm/charts/Chart.yaml)
echo "TAG=${CI_TAG}" >> $GITHUB_ENV
Expand All @@ -146,8 +151,9 @@ jobs:
type=raw,value=latest,enable=false
type=raw,value=${{ env.TAG }}
- name: Print Tags
- name: Print Tag info
run: |
echo "BRANCH: ${{ env.BRANCH }}"
echo "${{ steps.docker_meta.outputs.tags }}"
- name: Set up QEMU
Expand Down Expand Up @@ -198,6 +204,7 @@ jobs:
DBUILD_DATE=${{ steps.date.outputs.DATE }}
DBUILD_REPO_URL=https://github.com/openebs/dynamic-localpv-provisioner
DBUILD_SITE_URL=https://openebs.io
BRANCH=${{ env.BRANCH }}
release-chart:
runs-on: ubuntu-latest
Expand Down
31 changes: 22 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,17 +141,29 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- uses: cachix/install-nix-action@v22
- name: Pre-populate nix-shell
run: |
export NIX_PATH=nixpkgs=$(jq '.nixpkgs.url' nix/sources.json -r)
echo "NIX_PATH=$NIX_PATH" >> $GITHUB_ENV
nix-shell --pure --run "echo" ./shell.nix
- name: Check if the chart is publishable
run: |
TAG=${{ github.event.release.tag_name }}
nix-shell --pure --run "./scripts/update-chart-version.sh --tag $TAG --publish-release" ./shell.nix
- name: Set Image Org
# sets the default IMAGE_ORG to openebs
run: |
[ -z "${{ secrets.IMAGE_ORG }}" ] && IMAGE_ORG=openebs || IMAGE_ORG=${{ secrets.IMAGE_ORG}}
echo "IMAGE_ORG=${IMAGE_ORG}" >> $GITHUB_ENV
- name: Set Release Tag
- name: Set IMAGE_TAG and BRANCH
run: |
TAG=$(shell awk -F': ' '/^version:/ {print $$2}' deploy/helm/charts/Chart.yaml)
TAG="${GITHUB_REF#refs/*/v}"
echo "RELEASE_TAG=${TAG}" >> $GITHUB_ENV
BRANCH=${{ github.ref_name }}
echo "BRANCH=$BRANCH" >> $GITHUB_ENV
echo "IMAGE_TAG=$(awk -F': ' '/^version:/ {print $2}' deploy/helm/charts/Chart.yaml)" >> $GITHUB_ENV
- name: Set Build Date
id: date
Expand All @@ -168,12 +180,13 @@ jobs:
quay.io/${{ env.IMAGE_ORG }}/provisioner-localpv
ghcr.io/${{ env.IMAGE_ORG }}/provisioner-localpv
tags: |
type=semver,pattern={{version}}
type=raw,value=latest,enable=false
type=raw,value=${{ env.IMAGE_TAG }}
- name: Print Tags
- name: Print Tag info
run: |
echo "${{ steps.docker_meta.outputs.tags }}"
echo "RELEASE TAG: ${RELEASE_TAG}"
echo "BRANCH: ${{ env.BRANCH }}"
echo "RELEASE_TAG: ${{ steps.docker_meta.outputs.tags }}"
- name: Setup QEMU
uses: docker/setup-qemu-action@v2
Expand Down Expand Up @@ -219,7 +232,7 @@ jobs:
DBUILD_DATE=${{ steps.date.outputs.DATE }}
DBUILD_REPO_URL=https://github.com/openebs/dynamic-localpv-provisioner
DBUILD_SITE_URL=https://openebs.io
RELEASE_TAG=${{ env.RELEASE_TAG }}
BRANCH=${{ env.BRANCH }}
release-chart:
runs-on: ubuntu-latest
Expand Down

0 comments on commit f0f4acc

Please sign in to comment.