1
0
Fork 0

Changing Workflow

This commit is contained in:
Joao M 2022-09-01 18:08:08 +00:00
parent 81ea3000bf
commit a8953a3d10

View file

@ -86,6 +86,34 @@ 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
@ -94,7 +122,7 @@ jobs:
context: . context: .
file: build/Dockerfile file: build/Dockerfile
build-args: | build-args: |
RELEASE_VERSION_ARG="${{ join(steps.tags.outputs.result, ',') }}" RELEASE_VERSION_ARG="${{ steps.tags.outputs.result }}"
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' || github.event.inputs.push == 'true' }} push: ${{ github.event_name != 'pull_request' || github.event.inputs.push == 'true' }}
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
@ -110,7 +138,7 @@ jobs:
Helm: Helm:
runs-on: 'ubuntu-latest' runs-on: 'ubuntu-latest'
needs: Build needs: Build
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v') if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')
env: env:
DOC_GITHUB_TOKEN: '${{ secrets.DOC_TOKEN }}' DOC_GITHUB_TOKEN: '${{ secrets.DOC_TOKEN }}'
steps: steps:
@ -119,7 +147,7 @@ jobs:
Documentation: Documentation:
runs-on: 'ubuntu-latest' runs-on: 'ubuntu-latest'
needs: Build needs: Helm
if: github.ref == 'refs/heads/master' if: github.ref == 'refs/heads/master'
env: env:
DOC_GITHUB_TOKEN: '${{ secrets.DOC_TOKEN }}' DOC_GITHUB_TOKEN: '${{ secrets.DOC_TOKEN }}'