Nightly Build #82
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: Nightly Build | |
on: | |
schedule: | |
- cron: '*/30 * * * *' # This schedule runs every night at midnight UTC | |
jobs: | |
nightly: | |
runs-on: self-hosted | |
steps: | |
- name: Ensure workspace ownership | |
run: echo "chown -R $USER $GITHUB_WORKSPACE" && sudo chown -R $USER $GITHUB_WORKSPACE | |
- name: Check out code | |
uses: actions/checkout@v3 | |
- name: Prepare release body | |
run: | | |
RELEASE_DATETIME=$(date --rfc-3339=seconds) | |
cat <<EOF > release_template.md | |
Release created at $RELEASE_DATETIME | |
EOF | |
envsubst < release_template.md > release_body.md | |
- name: Start builder container | |
run: | | |
TZ=$(readlink -f /etc/localtime | awk -F '/zoneinfo/' '{print $2}') | |
sudo docker rm -f infinity_build && sudo docker run -d --name infinity_build --network=host -e TZ=$TZ -v $PWD:/infinity infiniflow/infinity_build:0.1 | |
- name: Build release version | |
run: sudo docker exec infinity_build bash -c "cd /infinity && rm -fr cmake-build-release && mkdir -p cmake-build-release && cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -S /infinity -B /infinity/cmake-build-release && cmake --build /infinity/cmake-build-release" | |
- name: Build RPM and DEB | |
run: sudo docker exec infinity_build bash -c "cd /infinity/cmake-build-release && cpack" | |
- name: Remove existing tag | |
# https://github.com/softprops/action-gh-release/issues/171 | |
run: git push origin :refs/tags/nightly || true | |
- name: Create or overwrite a releae | |
# https://github.com/actions/upload-release-asset has been replaced by https://github.com/softprops/action-gh-release | |
uses: softprops/action-gh-release@v1 | |
with: | |
token: ${{ secrets.MY_GITHUB_TOKEN }} # Use the secret as an environment variable | |
prerelease: true | |
tag_name: nightly | |
# The body field does not support environment variable substitution directly. | |
body_path: release_body.md | |
files: | | |
cmake-build-release/infinity-*.deb | |
cmake-build-release/infinity-*.rpm | |
cmake-build-release/infinity-*.tar.gz |