Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update script to retain CNAME file #49

Merged
merged 1 commit into from
Mar 14, 2024
Merged

Conversation

jcleigh
Copy link
Contributor

@jcleigh jcleigh commented Feb 8, 2024

The existing entrypoint.sh script removes historical builds, which also removes the CNAME file created by setting a custom domain name in GitHub Pages settings. Added grep -v 'CNAME' to remove that filename (if it exists) from the file list pipe.

Local shell testing verifies it works. I prepared an empty directory with:

touch 1
touch 2
touch 5
touch 10
touch CNAME

Here is the result of the original code:

> ls
1  10  2  5  CNAME
> ls | sort -n
CNAME
1
2
5
10
> ls | sort -n | head -n -2
CNAME
1
2
> ls | sort -n | head -n -2 | xargs rm -rv
removed 'CNAME'
removed '1'
removed '2'
> ls
10  5

Here is the updated code with grep -v 'CNAME' in the pipe:

> ls
1  10  2  5  CNAME
> ls | sort -n | grep -v 'CNAME' | head -n -2 | xargs rm -rv
removed '1'
removed '2'
> ls
10  5  CNAME

Here is the updated code but CNAME file does not exist, showing that this change is non-breaking:

> ls
1  10  2  5
> ls | sort -n | grep -v 'CNAME' | head -n -2 | xargs rm -rv
removed '1'
removed '2'
> ls
10  5

I have also run Actions against my company's private repo pointed at my change branch and the CNAME file is no longer being deleted.

@jcleigh
Copy link
Contributor Author

jcleigh commented Feb 12, 2024

@simple-elf Are you able to review or provide feedback on this? Thanks!

@baev baev merged commit 003527c into simple-elf:master Mar 14, 2024
@jcleigh jcleigh deleted the keep-cname branch December 9, 2024 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants