Update build.yml
This commit is contained in:
parent
775b1c4cc7
commit
cd230528f0
1 changed files with 27 additions and 3 deletions
30
.github/workflows/build.yml
vendored
30
.github/workflows/build.yml
vendored
|
|
@ -87,7 +87,29 @@ jobs:
|
|||
result-encoding: string
|
||||
|
||||
- name: Get Tags
|
||||
run: echo "${{ steps.tags.outputs.result }}"
|
||||
run: |
|
||||
echo "${{ steps.tags.outputs.result }}"
|
||||
|
||||
- uses: actions/github-script@v6
|
||||
id: normalized
|
||||
with:
|
||||
script: |
|
||||
tags = `${{ join(steps.meta.outputs.tags, ',') }}`
|
||||
result = []
|
||||
tags.split("\n").forEach(function (item) {
|
||||
short_tag = item.trim().split(":")[1];
|
||||
if (short_tag == "master" || short_tag == "main") {
|
||||
result.push("${{ env.IMAGE_NAME }}:latest");
|
||||
} else if (short_tag != "latest") {
|
||||
result.push("${{ env.IMAGE_NAME }}:" + short_tag);
|
||||
}
|
||||
})
|
||||
return result.join(",");
|
||||
result-encoding: string
|
||||
|
||||
- name: Get Normalized Docker Image
|
||||
run: |
|
||||
echo "${{ steps.normalized.outputs.result }}"
|
||||
|
||||
# Build and push Docker image with Buildx (don't push on PR)
|
||||
# https://github.com/docker/build-push-action
|
||||
|
|
@ -100,7 +122,7 @@ jobs:
|
|||
RELEASE_VERSION_ARG="${{ steps.tags.outputs.result }}"
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: ${{ github.event_name != 'pull_request' || github.event.inputs.push == 'true' }}
|
||||
tags: ${{ steps.tags.outputs.result }}
|
||||
tags: ${{ steps.normalized.outputs.result }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
|
||||
outputs:
|
||||
|
|
@ -139,7 +161,9 @@ jobs:
|
|||
CURRENT_VERSION=$(grep "appVersion: " helm/easyhaproxy/Chart.yaml | sed 's#appVersion: "\(.*\)"#\1#g')
|
||||
|
||||
if [ "$TAG" = "$CURRENT_VERSION" ]; then
|
||||
echo "Skipping update version..."
|
||||
echo "Skipping version $CURRENT_VERSION..."
|
||||
elif [ "$TAG" = "latest" ]; then
|
||||
echo "Skipping latest 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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue