awx-local-setup: simplify release workflow and add kustomize validation
This commit is contained in:
65
.github/workflows/release.yml
vendored
65
.github/workflows/release.yml
vendored
@@ -1,33 +1,5 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Create tarball
|
||||
run: |
|
||||
tar -czf awx-local-setup-${{ github.ref_name }}.tar.gz awx-local-setup
|
||||
- name: Create GitHub Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
tag_name: ${{ github.ref_name }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Upload release asset
|
||||
uses: actions/upload-release-asset@v1
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: ./awx-local-setup-${{ github.ref_name }}.tar.gz
|
||||
asset_name: awx-local-setup-${{ github.ref_name }}.tar.gz
|
||||
asset_content_type: application/gzip
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
@@ -36,11 +8,46 @@ on:
|
||||
jobs:
|
||||
publish:
|
||||
name: Create GitHub Release and upload artifact
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Ensure kubectl is available
|
||||
run: |
|
||||
if ! command -v kubectl >/dev/null 2>&1; then
|
||||
curl -sSL -o kubectl "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
|
||||
chmod +x kubectl
|
||||
sudo mv kubectl /usr/local/bin/kubectl
|
||||
fi
|
||||
|
||||
- name: Run kustomize build for known directories
|
||||
run: |
|
||||
set -e
|
||||
ok=true
|
||||
for d in config config/*; do
|
||||
if [ -d "$d" ] && ( [ -f "$d/kustomization.yaml" ] || [ -f "$d/kustomization.yml" ] ); then
|
||||
echo "Building kustomize for $d"
|
||||
kubectl kustomize "$d" >/dev/null || { ok=false; echo "kustomize build failed for $d"; }
|
||||
fi
|
||||
done
|
||||
$ok || (echo "One or more kustomize builds failed" && exit 1)
|
||||
|
||||
- name: Kustomize -> kubectl --dry-run=client validation
|
||||
run: |
|
||||
set -e
|
||||
any=false
|
||||
for d in config config/*; do
|
||||
if [ -d "$d" ] && ( [ -f "$d/kustomization.yaml" ] || [ -f "$d/kustomization.yml" ] ); then
|
||||
echo "Validating manifests from $d with kubectl --dry-run=client"
|
||||
kubectl kustomize "$d" | kubectl apply --dry-run=client -f - || { echo "kubectl --dry-run failed for $d"; exit 1; }
|
||||
any=true
|
||||
fi
|
||||
done
|
||||
if [ "$any" = false ]; then
|
||||
echo "No kustomize directories found to validate with kubectl"
|
||||
fi
|
||||
|
||||
- name: Create tarball
|
||||
run: |
|
||||
tar -czf awx-local-setup-${{ github.ref_name }}.tar.gz awx-local-setup
|
||||
|
||||
Reference in New Issue
Block a user