Skip to content

Nightly Release

Nightly Release #189

Workflow file for this run

name: Nightly Release
on:
schedule:
- cron: '0 2 * * *' # run at 2 AM UTC
jobs:
nightly:
name: Nightly Release
runs-on: ubuntu-latest
if: github.repository_owner == 'coreruleset' # do not run for forks
steps:
- name: Check GH API rate limits
run: |
gh api -i repos/coreruleset/coreruleset/releases/latest | grep -i "x-ratelimit"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "Checkout repo"
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.2
- name: Delete previous nightly release
run: |
gh release delete --repo coreruleset/coreruleset --cleanup-tag --yes nightly
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create nightly release
run: |
notes=$(cat <<"EOF"
Nightly releases are snapshots of the development activity on the Core Rule Set project that may include new features and bug fixes scheduled for upcoming releases. These releases are made available to make it easier for users to test their existing configurations against the Core Rule Set code base for potential issues or to experiment with new features, with a chance to provide feedback on ways to improve the changes before being released.
As these releases are snapshots of the latest code, you may encounter an issue compared to the latest stable release so users are encouraged to run nightly releases in a non production environment. If you encounter an issue, please check our issue tracker to see if the issue has already been reported; if a report hasn't been made, please report it so we can review the issue and make any needed fixes.
EOF
)
gh release create \
--repo coreruleset/coreruleset \
--latest \
--prerelease \
--draft=false \
--title "Latest Nightly" \
--notes "${notes}" \
nightly
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish draft if necessary
run: |
echo "A race condition in the GH API can cause a release published for a previously existing tag to be published as draft."
echo "Wait for 30 seconds for the API to catch up to the actual state, then check that the release has been properly published."
echo "If the release is still a draft, publish it."
sleep 30
if gh release list --repo coreruleset/coreruleset --exclude-drafts | grep --quiet nightly; then
echo "Nightly release was created properly"
exit 0
fi
echo "Nightly release was created as draft. Publishing now."
gh release edit \
--repo coreruleset/coreruleset \
--latest \
--prerelease \
--draft=false \
nightly
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Check GH API rate limits
run: |
gh api -i repos/coreruleset/coreruleset/releases/latest | grep -i "x-ratelimit"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}