Nightly Deployment #1290
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
on: | |
schedule: | |
- cron: "0 0 * * *" | |
name: Nightly Deployment | |
jobs: | |
deploy: | |
name: Deployment | |
runs-on: windows-latest | |
defaults: | |
run: | |
shell: bash | |
steps: | |
# - name: Calculate depth | |
# id: depth | |
# run: | | |
# echo DEPTH=$(($(echo '${{toJSON(github.event.commits)}}' | jq '. | length') + 1)) | |
# echo ::set-output name=DEPTH::$(($(echo '${{toJSON(github.event.commits)}}' | jq '. | length') + 1)) | |
# - name: Checkout code | |
# uses: actions/checkout@v4 | |
# with: | |
# fetch-depth: ${{steps.depth.outputs.DEPTH}} | |
# - name: Check changes | |
# run: | | |
# git diff --name-only $(echo ${{github.event.compare}} | grep -oE '([a-z0-9]+\.\.\.[a-z0-9]+)') | |
# if ! git diff --name-only $(echo ${{github.event.compare}} | grep -oE '([a-z0-9]+\.\.\.[a-z0-9]+)') | grep -E '(\.rc$)'; then | |
# echo "No resource files changed. Won't making new release." | |
# echo ::set-env name=RC_CHANGED::0 | |
# else | |
# echo "Changes detected on resource files. Will making new release." | |
# echo ::set-env name=RC_CHANGED::1 | |
# fi | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 100 | |
- name: Check changes | |
id: changes | |
continue-on-error: true | |
run: | | |
FROM_COMMIT=$(git rev-list -n1 --before="24 hours" --first-parent HEAD) | |
git diff $FROM_COMMIT..HEAD --name-only | |
if ! git diff $FROM_COMMIT..HEAD --name-only | grep -E '^((Dialog)|(Manual)|(Menu)|(Module)|(Other)|(StringTable)|(System)|(VersionInfo)|(240)|(1\.44)\/)'; then | |
echo "No files translated. Aborting!" | |
exit 1 | |
else | |
echo "Some files translated. Continuing." | |
fi | |
- name: Install required packages | |
if: steps.changes.outcome == 'success' | |
run: choco install reshack | |
- name: Build | |
id: build | |
if: steps.changes.outcome == 'success' | |
run: | | |
cd _script | |
bash workflow/build-all-nightly.sh | |
- name: Write release body | |
if: steps.changes.outcome == 'success' | |
# run: | | |
# echo "\ | |
# ## Release Notes | |
# " >> release.txt | |
# if [ ! -s _deploy/release-notes.md ]; then | |
# echo '${{github.event.head_commit.message}}' >> release.txt | |
# else | |
# cat _deploy/release-notes.md >> release.txt | |
# fi | |
# echo "\ | |
# ## Commits | |
# " >> release.txt | |
# for row in $(echo '${{toJSON(github.event.commits)}}' | jq -r '.[] | @base64'); do | |
# _jq() { | |
# echo ${row} | base64 --decode | jq -r ${1} | |
# } | |
# echo - $(_jq '.id') $(_jq '.message' | awk '{gsub(/\\n/,"\n")}1' | head -1) \($(_jq '.committer.username')\) >> release.txt | |
# done | |
# echo "\ | |
# ---- | |
# *Commit pushed by ${{github.event.head_commit.author.name}} (${{github.event.head_commit.author.username}}) on ${{github.event.head_commit.timestamp}}* | |
# *Built on ${{steps.build.outputs.BUILD_DATE_TIDY}}*" >> release.txt | |
run: | | |
echo "\ | |
## Release Notes | |
" >> release.txt | |
if [ ! -s _deploy/release-notes.md ]; then | |
echo "*No release notes supplied.*" >> release.txt | |
else | |
cat _deploy/release-notes.md >> release.txt | |
fi | |
echo "\ | |
---- | |
*Built on ${{steps.build.outputs.BUILD_DATE_FULL}}.*" >> release.txt | |
- name: Create release | |
if: steps.changes.outcome == 'success' | |
uses: softprops/action-gh-release@v2 | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
with: | |
tag_name: en.${{steps.build.outputs.VERSION_NUM}}-nightly.${{steps.build.outputs.BUILD_DATE}} | |
name: Build ${{steps.build.outputs.VERSION_NUM}} (Nightly ${{steps.build.outputs.BUILD_DATE_TIDY}}) | |
prerelease: true | |
files: | | |
_script/dist/Domino143_Translated.zip | |
_script/dist/Domino143_Translated.exe | |
_script/dist/Domino144_Translated.zip | |
_script/dist/Domino144_Translated.exe | |
body_path: release.txt | |
# - name: Create release | |
# id: create_release | |
# uses: actions/create-release@v1 | |
# env: | |
# GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
# with: | |
# tag_name: 1.43-en.${{steps.build.outputs.VERSION_NUM}}-nightly.${{steps.build.outputs.BUILD_DATE}} | |
# release_name: Build ${{steps.build.outputs.VERSION_NUM}}-nightly.${{steps.build.outputs.BUILD_DATE}} – ${{steps.build.outputs.BUILD_DATE_TIDY}} | |
# prerelease: true | |
# - name: Upload 1 | |
# uses: actions/upload-release-asset@v1 | |
# env: | |
# GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
# with: | |
# upload_url: ${{steps.create_release.outputs.upload_url}} | |
# asset_path: Domino143_Translated_v${{steps.build.outputs.VERSION_NUM}}-nightly.${{steps.build.outputs.BUILD_DATE}}.zip | |
# asset_name: Domino143_Translated_v${{steps.build.outputs.VERSION_NUM}}-nightly.${{steps.build.outputs.BUILD_DATE}}.zip | |
# asset_content_type: application/zip | |
# - name: Upload 2 | |
# uses: actions/upload-release-asset@v1 | |
# env: | |
# GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
# with: | |
# upload_url: ${{steps.create_release.outputs.upload_url}} | |
# asset_path: Domino_Translated_v${{steps.build.outputs.VERSION_NUM}}-nightly.${{steps.build.outputs.BUILD_DATE}}.exe | |
# asset_name: Domino_Translated_v${{steps.build.outputs.VERSION_NUM}}-nightly.${{steps.build.outputs.BUILD_DATE}}.exe | |
# asset_content_type: application/octet-stream |