Skip to content

Release MacOS hosts #372

Release MacOS hosts

Release MacOS hosts #372

name: 'Build on Release'
on:
schedule:
- cron: '0 0 * * *' # Scheduled at 00:00 every day
workflow_dispatch: {}
permissions:
id-token: write
contents: write
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)) < (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
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
done
# Clean up the array to be a plain space-separated string
versions_to_release_json=$(echo "${versions_to_release[@]}" | tr -d '[:space:]')
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) }}
# 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 }}