Skip to content

Nightly

Nightly #40

name: Nightly
on:
schedule:
- cron: '0 1 * * *'
workflow_dispatch:
jobs:
test_token:
runs-on: ubuntu-latest
steps:
- name: Show actor
run: 'echo "Actor: ${{ github.actor }}"'
- name: Test auth with GITHUB_TOKEN
run: echo "${{ secrets.GITHUB_TOKEN }}" | head -c 20
# publish_images:
# permissions:
# packages: write # Required for pushing images to ghcr.io
# runs-on: ubuntu-latest
# steps:
# - name: Checkout code
# uses: actions/checkout@v4
# - name: Login to GHCR registry
# uses: docker/login-action@v3
# with:
# registry: ghcr.io
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
# - name: Setup Docker Buildx
# uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
# - name: Set image tag
# run: echo "TAG=v0.0.0-45678" >> "$GITHUB_ENV"
# - name: Build and push image
# env:
# REPO: ghcr.io/krunalhinguu
# run: |
# make image-push
# delete-ghcr-images:
# runs-on: ubuntu-latest
# steps:
# - name: Delete GHCR image versions
# env:
# GH_TOKEN: ${{ secrets.GHCR_TOKEN }} # Use PAT with `packages:read,write,delete`
# OWNER: krunalhinguu # Change this
# IMAGE: aks-operator # Change this
# run: |
# echo "Fetching versions for ghcr.io/$OWNER/$IMAGE"
# response=$(curl -s -H "Authorization: Bearer $GH_TOKEN" \
# -H "Accept: application/vnd.github+json" \
# "https://api.github.com/users/$OWNER/packages/container/$IMAGE/versions")
# echo "Raw API response:"
# echo "$response" | jq
# versions=$(echo "$response" | jq -r '.[] | .id')
# for version in $versions; do
# echo "Deleting version ID: $version"
# curl -X DELETE \
# -H "Authorization: Bearer $GH_TOKEN" \
# -H "Accept: application/vnd.github+json" \
# "https://api.github.com/users/$OWNER/packages/container/$IMAGE/versions/$version"
# done
- name: Delete old package versions from GHCR
uses: actions/delete-package-versions@v4
with:
package-name: 'aks-operator' # Replace with your image name
package-type: 'container' # Specify it's a container image
min-versions-to-keep: 1 # Keep at least 3 versions
token: ${{ secrets.GITHUB_TOKEN }} # Use your token stored in GitHub Secrets
owner: 'krunalhinguu' # Replace with your GitHub username (for personal account)