Merge pull request #13 from gimlet-io/release-automation

Release automation
This commit is contained in:
Laszlo Fogas
2021-04-17 18:28:39 +02:00
committed by GitHub
3 changed files with 97 additions and 1 deletions
+94
View File
@@ -0,0 +1,94 @@
name: Release
on:
push:
tags:
- 'v*'
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout main
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Extract tag version
id: versioning
run: |
tag=${GITHUB_REF/refs\/tags\//}
tag=${tag#v}
echo ::set-output name=tag_version::$tag
- name: Extract chart version
id: chart_version
run: |
CHART_VERSION=$(cat charts/onechart/Chart.yaml | grep version:)
CHART_VERSION=${CHART_VERSION#version: }
echo $CHART_VERSION
echo ::set-output name=chart_version::$CHART_VERSION
- name: Ensure tag and chart version matches
run: |
echo "Run ${{ steps.versioning.outputs.VERSION }}"
echo "${{ steps.chart_version.outputs.CHART_VERSION }}"
echo "$TAG_VERSION"
echo "$CHART_VERSION"
if [ "$TAG_VERSION" != "$CHART_VERSION" ]
then
echo "Tag version does not match chart version"
exit 1
fi
env:
TAG_VERSION: ${{ steps.versioning.outputs.tag_version }}
CHART_VERSION: ${{ steps.chart_version.outputs.chart_version }}
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Publishing to the Helm repository
run: |
git config --global user.email "action@github.com"
git config --global user.name "Github Action"
git checkout release-automation
make package
git add .
git commit -m "Publishing $TAG_VERSION to the Helm repository"
git push origin release-automation
env:
TAG_VERSION: ${{ steps.versioning.outputs.tag_version }}
- name: Preparing the next release version
run: |
git config --global user.email "action@github.com"
git config --global user.name "Github Action"
git checkout release-automation
without_major_version=${CHART_VERSION#*.}
without_patch_version=${without_major_version%.*}
increased_minor_version=$(($without_patch_version + 1))
major_version=${CHART_VERSION%%.*}
increased_version="$major_version.$increased_minor_version.0"
echo "The new version will be $increased_version"
sed -i "s/version: $CHART_VERSION/version: $increased_version/" charts/onechart/Chart.yaml
git status
git add .
git commit -m "The next release version will be $increased_version"
git push origin release-automation
env:
CHART_VERSION: ${{ steps.chart_version.outputs.chart_version }}
+2
View File
@@ -73,3 +73,5 @@ TODO: move it to the Makefile
`make all` to test and package the Helm chart.
The chart archives are put under `docs/` together with the Helm repository manifest (index.yaml)
It is then served with Github Pages on https://chart.onechart.dev
Github Actions is used to automate the make calls on git tag events.
+1 -1
View File
@@ -15,4 +15,4 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.18.0
version: 0.19.0