1
0
Fork 0

Update Github Actions

This commit is contained in:
Joao M 2022-09-02 03:36:50 +00:00
parent a8953a3d10
commit 2dbfa10219

View file

@ -86,34 +86,6 @@ jobs:
- name: Get result - name: Get result
run: echo "${{steps.set-result.outputs.result}}" run: echo "${{steps.set-result.outputs.result}}"
- name: Update versions
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')
run: |
TAG="${{ steps.tags.outputs.result }}"
CURRENT_VERSION=$(grep "appVersion: " helm/easyhaproxy/Chart.yaml | sed 's#appVersion: "\(.*\)"#\1#g')
if [ "$TAG" = "$CURRENT_VERSION" ]; then
echo "Skipping update version..."
else
sed -i "s#easy-haproxy:[a-zA-Z0-9\.]*#easy-haproxy:$TAG#g" deploy/docker/docker-compose.yml
sed -i "s#version: \"[a-zA-Z0-9\.]*\"#version: \"$TAG\"#g" deploy/kubernetes/easyhaproxy-*.yml
sed -i "s#easy-haproxy:[a-zA-Z0-9\.]*#easy-haproxy:$TAG#g" deploy/kubernetes/easyhaproxy-*.yml
sed -i "s#easy-haproxy/[a-zA-Z0-9\.]*/#easy-haproxy/$TAG/#g" docs/kubernetes.md
sed -i "s#appVersion: \"[a-zA-Z0-9\.]*\"#appVersion: \"$TAG\"#g" helm/easyhaproxy/Chart.yaml
VERSION=$(grep "version: " helm/easyhaproxy/Chart.yaml | sed 's#version: ##g')
NEW_VERSION=$(echo $VERSION | awk -F. '/[0-9]+\./{$NF++;print}' OFS=.)
sed -i "s#version: [a-zA-Z0-9\.]*#version: $NEW_VERSION#g" helm/easyhaproxy/Chart.yaml
sed -i "s#chart: easyhaproxy-[a-zA-Z0-9\.]*#chart: easyhaproxy-$NEW_VERSION#g" deploy/kubernetes/easyhaproxy-*.yml
git add .
git commit -m "[skip ci] Update from $TAG to $CURRENT_VERSION"
git push
fi
# Build and push Docker image with Buildx (don't push on PR) # Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action # https://github.com/docker/build-push-action
- name: Build and push Docker image - name: Build and push Docker image
@ -142,7 +114,41 @@ jobs:
env: env:
DOC_GITHUB_TOKEN: '${{ secrets.DOC_TOKEN }}' DOC_GITHUB_TOKEN: '${{ secrets.DOC_TOKEN }}'
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
if: startsWith(github.ref, 'refs/tags/')
with:
ref: master
- uses: actions/checkout@v3
if: github.ref == 'refs/heads/master'
- name: Update versions
if: startsWith(github.ref, 'refs/tags/')
run: |
TAG="${{ steps.tags.outputs.result }}"
CURRENT_VERSION=$(grep "appVersion: " helm/easyhaproxy/Chart.yaml | sed 's#appVersion: "\(.*\)"#\1#g')
if [ "$TAG" = "$CURRENT_VERSION" ]; then
echo "Skipping update version..."
else
sed -i "s#easy-haproxy:[a-zA-Z0-9\.]*#easy-haproxy:$TAG#g" deploy/docker/docker-compose.yml
sed -i "s#version: \"[a-zA-Z0-9\.]*\"#version: \"$TAG\"#g" deploy/kubernetes/easyhaproxy-*.yml
sed -i "s#easy-haproxy:[a-zA-Z0-9\.]*#easy-haproxy:$TAG#g" deploy/kubernetes/easyhaproxy-*.yml
sed -i "s#easy-haproxy/[a-zA-Z0-9\.]*/#easy-haproxy/$TAG/#g" docs/kubernetes.md
sed -i "s#appVersion: \"[a-zA-Z0-9\.]*\"#appVersion: \"$TAG\"#g" helm/easyhaproxy/Chart.yaml
VERSION=$(grep "version: " helm/easyhaproxy/Chart.yaml | sed 's#version: ##g')
NEW_VERSION=$(echo $VERSION | awk -F. '/[0-9]+\./{$NF++;print}' OFS=.)
sed -i "s#version: [a-zA-Z0-9\.]*#version: $NEW_VERSION#g" helm/easyhaproxy/Chart.yaml
sed -i "s#chart: easyhaproxy-[a-zA-Z0-9\.]*#chart: easyhaproxy-$NEW_VERSION#g" deploy/kubernetes/easyhaproxy-*.yml
git add .
git commit -m "[skip ci] Update from $CURRENT_VERSION to $TAG"
git push
fi
- run: curl https://opensource.byjg.com/add-helm.sh | bash /dev/stdin helm easyhaproxy - run: curl https://opensource.byjg.com/add-helm.sh | bash /dev/stdin helm easyhaproxy
Documentation: Documentation: