Skip to content

Commit

Permalink
Added release github action support (#7)
Browse files Browse the repository at this point in the history
Signed-off-by: Raviv Schaffer <[email protected]>
  • Loading branch information
Raviv-S authored Aug 11, 2022
1 parent cd3efdd commit 9844714
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 1 deletion.
68 changes: 68 additions & 0 deletions .github/workflows/push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Push

on:
push:
branches:
- 'main'
tags:
- '*'

env:
DOCKER_HOSTNAME: ghcr.io
DOCKER_NAMESPACE: fybrik
DOCKER_USERNAME: ${{ github.actor }}

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

steps:
- uses: actions/checkout@v3
# Versions are created as follows (In helm 3.7 and above OCI reference tags
# must be valid SemVer):
# - Tags starting with v will be released as what comes after `v`. (e.g. refs/tags/v1.0 -> 1.0).
# - Main branch will be released with `main` as version tag for the docker images and
# `0.0.0-master` tag for helm chart.
- id: version
name: Infer version
run: |
if [[ ${GITHUB_REF} == refs/tags/* ]] ;
then
version="${GITHUB_REF#refs/tags/v}"
echo "HELM_TAG=${version}" >> $GITHUB_ENV
elif [[ ${GITHUB_REF} == refs/heads/main ]] ;
then
version=main
echo "HELM_TAG=0.0.0-main" >> $GITHUB_ENV
fi
echo "DOCKER_TAG=${version}" >> $GITHUB_ENV
- name: Helm tool installer
uses: Azure/setup-helm@v1
with:
version: v3.7.0
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
pip install pipenv
- name: Build docker image
run: make build
- name: Docker push
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login -u "${{ env.DOCKER_USERNAME }}" --password-stdin "${{ env.DOCKER_HOSTNAME }}"
make docker-push
- run: docker images
- name: Install yq
run: make ./hack/tools/bin/yq
- name: Update docker image tag in the chart value.yaml file
run: ./hack/tag_value.sh
- name: Helm chart push
run: |
export HELM_EXPERIMENTAL_OCI=1
echo "${{ secrets.GITHUB_TOKEN }}" | helm registry login -u "${{ github.actor }}" --password-stdin "${{ env.DOCKER_HOSTNAME }}"
make helm-chart-push
7 changes: 7 additions & 0 deletions hack/tag_value.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash
# Copyright 2020 IBM Corp.
# SPDX-License-Identifier: Apache-2.0

: ${TOOLBIN:=./hack/tools/bin}

${TOOLBIN}/yq eval --inplace ".image.tag = \"$DOCKER_TAG\"" helm/delete-module/values.yaml
2 changes: 1 addition & 1 deletion helm/delete-module/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
replicaCount: 1

image:
repository: ghcr.io/raviv-s/delete-module
repository: ghcr.io/fybrik/delete-module
tag: 0.0.0
pullPolicy: Always
pullSecret: null
Expand Down

0 comments on commit 9844714

Please sign in to comment.