Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: Lukasz Dziedziak <[email protected]>
  • Loading branch information
lukidzi committed Jan 10, 2025
1 parent 93bf84e commit 3bd116b
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 54 deletions.
48 changes: 14 additions & 34 deletions .github/workflows/release-hosts.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 'Build on Release'
name: 'Build and Release on Schedule'

on:
schedule:
Expand Down Expand Up @@ -32,48 +32,28 @@ jobs:
for envoy_version in "${envoy_versions[@]}"; do
echo "Checking if $envoy_version has been already released"
version=$(gh api repos/kumahq/envoy-builds/releases --jq ".[] | select(.tag_name == \"$envoy_version\") | .tag_name")
# if [ -z "$version" ]; then
# echo "No version found for $envoy_version"
# version_without_v=$(echo "$envoy_version" | sed 's/^v//')
# versions_to_release+=("\"$version_without_v\"") # Add quotes for JSON compliance
# else
# echo "Envoy $version already released, skip"
# version_without_v=$(echo "$envoy_version" | sed 's/^v//')
# versions_to_release+=("\"$version_without_v\"") # Add quotes for JSON compliance
# fi
version_without_v=$(echo "$envoy_version" | sed 's/^v//')
versions_to_release+=("$version_without_v") # Add quotes for JSON compliance
if [ -z "$version" ]; then
echo "No version found for $envoy_version"
version_without_v=$(echo "$envoy_version" | sed 's/^v//')
versions_to_release+=("$version_without_v") # Add quotes for JSON compliance
else
echo "Envoy $version already released, skip"
fi
done
# Clean up the array to be a plain space-separated string
versions_to_release_json=$(printf '"%s", ' "${versions_to_release[@]}" | sed 's/, $//')
versions_to_release_json="[$versions_to_release_json]"
echo "versions_to_release_json=$versions_to_release_json" # Debugging step
echo "versions_to_release=$versions_to_release_json" >> $GITHUB_OUTPUT
trigger-release:
needs: get-envoy-versions
runs-on: ubuntu-latest
strategy:
matrix:
version: ${{ fromJson(needs.get-envoy-versions.outputs.versions_to_release) }}
version: ${{ needs.get-envoy-versions.outputs.versions_to_release }}
fail-fast: false
steps:
- name: Debug Output of versions_to_release
run: |
echo "versions_to_release: ${{ needs.get-envoy-versions.outputs.versions_to_release }}"
- name: Test Matrix Version
run: |
echo "Processing version: ${{ matrix.version }}"
# trigger-release:
# needs: get-envoy-versions
# strategy:
# matrix:
# version: ${{ needs.get-envoy-versions.outputs.versions_to_release }}
# fail-fast: false
# uses: ./.github/workflows/build-and-release.yaml
# secrets:
# AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
# with:
# version: ${{ matrix.version }}
uses: ./.github/workflows/build-and-release.yaml
secrets:
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
with:
version: ${{ matrix.version }}
45 changes: 25 additions & 20 deletions .github/workflows/release-on-schedule.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: 'Build on Release'
name: 'Build and Release on Schedule'

on:
schedule:
- cron: '0 0 * * *' #scheduled at 00:00 everyday
- cron: '0 0 * * *' # Scheduled at 00:00 every day
workflow_dispatch: {}

permissions:
Expand All @@ -12,43 +12,48 @@ permissions:
jobs:
get-envoy-versions:
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ github.token }}
outputs:
versions_to_release: ${{ steps.get-versions-to-release.outputs.versions_to_release }}
steps:
- name: Check Envoy released versions
id: check-envoy-released-versions
run: |
envoy_versions=$(gh api repos/envoyproxy/envoy/releases --jq '.[] | {tag_name, created_at} | select(((now | tonumber) - ((.created_at | fromdate) | tonumber)) < (24 * 3600)) | .tag_name')
echo "envoy_versions=$envoy_versions" >> $GITHUB_OUTPUT
envoy_versions=$(gh api repos/envoyproxy/envoy/releases --jq '.[] | {tag_name, created_at} | select(((now | tonumber) - ((.created_at | fromdate) | tonumber)) < (30 * 24 * 3600)) | .tag_name')
envoy_versions_str=$(echo $envoy_versions | tr '\n' ' ')
echo "envoy_versions=$envoy_versions_str" >> $GITHUB_OUTPUT
- name: Get Envoy versions to release
id: get-versions-to-release
run: |
versions_to_release=()
eval "envoy_versions=(${{ steps.check-envoy-released-versions.outputs.envoy_versions }})"
for envoy_version in $envoy_versions; do
for envoy_version in "${envoy_versions[@]}"; do
echo "Checking if $envoy_version has been already released"
version=$(gh api repos/kumahq/envoy-builds/releases --jq ".[] | select(.tag_name == \"$envoy_version\") | .tag_name")
version=$(gh api repos/kumahq/envoy-builds/releases --jq ".[] | select(.tag_name == \"$envoy_version\") | .tag_name")
if [ -z "$version" ]; then
echo "No version found for $envoy_version"
versions_to_release+=$envoy_version
version_without_v=$(echo "$envoy_version" | sed 's/^v//')
versions_to_release+=("$version_without_v") # Add quotes for JSON compliance
else
echo "Envoy $version already released, skip"
fi
done
echo "::set-output name=versions_to_release::$(echo ${versions_to_release[@]} | jq -R -s -c 'split(" ")')"
# Clean up the array to be a plain space-separated string
versions_to_release_json=$(printf '"%s", ' "${versions_to_release[@]}" | sed 's/, $//')
versions_to_release_json="[$versions_to_release_json]"
echo "versions_to_release=$versions_to_release_json" >> $GITHUB_OUTPUT
trigger-release:
needs: get-envoy-versions
strategy:
matrix:
version: ${{ fromJson(needs.get-envoy-versions.outputs.versions_to_release) }}
# fail-fast: false
# uses: ./.github/workflows/build-and-release.yaml
# with:
# version: ${{ matrix.version }}
steps:
- name: test
run: |
echo ${{ matrix.version }}
version: ${{ needs.get-envoy-versions.outputs.versions_to_release }}
fail-fast: false
uses: ./.github/workflows/build-and-release.yaml
secrets:
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
with:
version: ${{ matrix.version }}

0 comments on commit 3bd116b

Please sign in to comment.