Sync with upstream ingress-nginx releases and cherry-pick Rancher-specific changes #39
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Sync with upstream ingress-nginx releases and cherry-pick Rancher-specific changes | |
on: | |
schedule: | |
- cron: "0 0 * * *" # Runs daily at midnight | |
workflow_dispatch: | |
jobs: | |
create-branches: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: write | |
outputs: | |
new-release-branches: ${{ steps.create-release-branches.outputs.NEW_RELEASE_BRANCHES }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
path: 'rancher-ingress-nginx' | |
fetch-depth: 0 | |
fetch-tags: true | |
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
- name: Configure git user | |
run: | | |
echo "[INFO] Setting up git user in git repository." | |
git config --global user.email "krunal.hingu222@gmail.com" | |
git config --global user.name "Krunal Hingu" | |
- name: Fetch the new tags from kubernetes/ingress-nginx repository | |
run: | | |
cd rancher-ingress-nginx | |
$GITHUB_WORKSPACE/rancher-ingress-nginx/scripts/check-for-new-tag.sh | |
- name: Create new release branches in rancher/ingress-nginx | |
id: create-release-branches | |
run: | | |
cd rancher-ingress-nginx | |
$GITHUB_WORKSPACE/rancher-ingress-nginx/scripts/create-release-branch.sh | |
- name: Debug outputs | |
run: | | |
echo "NEW_RELEASE_BRANCHES: ${{ steps.create-release-branches.outputs.NEW_RELEASE_BRANCHES }}" | |
shell: bash | |
build-and-validate: | |
needs: create-branches | |
runs-on: ubuntu-latest | |
container: | |
image: rancher/dapper:v0.6.0 | |
permissions: | |
contents: write | |
id-token: write | |
strategy: | |
matrix: | |
branches: ${{ fromJSON(needs.create-branches.outputs.new-release-branches) }} | |
fail-fast: false | |
steps: | |
- name: Fix the not-a-git-repository issue | |
run: | | |
apk -U add git | |
git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
git config --global user.email "krunal.hingu222@gmail.com" | |
git config --global user.name "Krunal Hingu" | |
- name: Checkout repository with branch ${{ matrix.branches }} | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ matrix.branches }} | |
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
- name: Validate with Dapper for ${{ matrix.branches }} | |
run: | | |
git checkout ${{ matrix.branches }} | |
dapper validate | |
- name: Build with Dapper for ${{ matrix.branches }} | |
run: | | |
git stash --all | |
dapper build | |
- name: Push release tag for ${{ matrix.branches }} | |
run: | | |
git stash --all | |
if ! git push --quiet --no-progress origin $RELEASE_BRANCH; then | |
echo "[ERROR] Failed while pushing the branch $RELEASE_BRANCH to rancher repository. Skipping the version $RELEASE_BRANCH." | |
exit 1 | |
else | |
echo "[INFO] Successfully pushed branch $RELEASE_BRANCH: https://github.com/krunalhinguu/ingress-nginx/tree/$RELEASE_BRANCH" | |
fi | |
TAG="${RELEASE_BRANCH%-fix*}" | |
TAG="$TAG-rancher1" | |
echo "[INFO] Creating the tag: $TAG for branch: $RELEASE_BRANCH" | |
if ! git tag "$TAG" "$RELEASE_BRANCH"; then | |
echo "[ERROR] Failed while creating the tag $TAG in the repository." | |
exit 1 | |
fi | |
if ! git push origin "$TAG"; then | |
echo "[ERROR] Failed while pushing the tag $TAG to the repository." | |
exit 1 | |
else | |
echo "[INFO] Successfully pushed tag $TAG: https://github.com/krunalhinguu/ingress-nginx/releases/tag/$TAG" | |
fi | |
env: | |
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
RELEASE_BRANCH: ${{ matrix.branches }} |