Merge pull request #2342 from HDR-Development/sdi-suddy #1348
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: build_nightly | |
on: | |
push: | |
branches: | |
- dev | |
jobs: | |
# bump the version and build the changelog | |
version_and_changelog: | |
runs-on: ubuntu-20.04 | |
env: | |
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} | |
outputs: | |
version: ${{ steps.push_tag.outputs.version }} | |
changelog: ${{ steps.github_changelog.outputs.changelog }} | |
steps: | |
# fail out if this is not a merge commit | |
- name: ensure merge | |
if: ${{ !startsWith(github.event.head_commit.message, 'Merge') }} | |
run: exit 1 | |
- name: checkout version | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: get last merge | |
id: last_merge | |
shell: bash | |
run: | | |
echo "short_hash=$(echo $(git log --oneline --merges -n 10 | grep -m2 "pull request" | tail -n1 | cut -d' ' -f1))" >> $GITHUB_OUTPUT | |
- run: | | |
echo "Last Merge: ${{ steps.last_merge.outputs.short_hash }}" | |
# wait for any previous versions to be tagged and committed | |
- uses: lewagon/[email protected] | |
continue-on-error: true | |
with: | |
ref: ${{ steps.last_merge.outputs.short_hash }} | |
check-name: 'version_and_changelog' | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
wait-interval: 30 | |
allowed-conclusions: success,skipped,cancelled,failure | |
# tag push | |
- uses: jefflinse/pr-semver-bump@v1 | |
name: Bump and Tag Version | |
id: push_tag | |
with: | |
mode: bump | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
minor-label: semver:feature | |
patch-label: semver:patch | |
with-v: true | |
# github changelog | |
- name: "Generate release changelog" | |
id: github_changelog | |
uses: heinrichreimer/[email protected] | |
with: | |
sinceTag: ${{ steps.push_tag.outputs.old-version }} | |
stripHeaders: true | |
verbose: false | |
issuesWoLabels: false | |
maxIssues: 300 | |
stripGeneratorNotice: true | |
compareLink: false | |
simpleList: true | |
token: ${{ secrets.RELEASE_TOKEN }} | |
- name: Upload changelog | |
uses: actions/upload-artifact@v3 | |
with: | |
name: changelog | |
path: CHANGELOG.md | |
plugin_build: | |
env: | |
PLUGIN_NAME: hdr | |
runs-on: ubuntu-20.04 | |
needs: version_and_changelog | |
container: | |
image: hewdrawremix/hewdraw-builder:latest | |
steps: | |
- name: setup python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.9' # Version range or exact version of a Python version to use, using SemVer's version range syntax | |
- name: checkout version | |
uses: actions/checkout@v2 | |
#- name: Rust Cache | |
# uses: Swatinem/[email protected] | |
# with: | |
# workspaces: "plugin" | |
# cache-targets: true | |
# cache-all-crates: true | |
# build the project | |
- run: | | |
cd scripts && NO_RUST_NIGHTLY=1 python3 make_dist.py build version=${{ needs.version_and_changelog.outputs.version }}-nightly name=hdr && cd .. | |
env: | |
HOME: /root | |
## mock upload files | |
#- run: | | |
# mkdir distributions | |
# echo lol > distributions/hdr-switch.zip | |
# echo lol > distributions/hdr-ryujinx.zip | |
- name: Upload version artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: version | |
path: hdr_version.txt | |
- name: Upload distributions artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: distributions | |
path: distributions | |
############## handle uploading the files to the release ############## | |
upload_to_release: | |
runs-on: ubuntu-20.04 | |
needs: [plugin_build, version_and_changelog] | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: distributions | |
# upload asset | |
- name: Upload binaries to release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
file: '*.zip' | |
prerelease: true | |
file_glob: true | |
asset_name: the_asset | |
release_name: ${{ needs.version_and_changelog.outputs.version }}-nightly | |
tag: ${{ needs.version_and_changelog.outputs.version }} | |
overwrite: true | |
body: ${{ needs.version_and_changelog.outputs.changelog }} | |
# wait for any previous nightlies to complete, since we dont want to step on any | |
# full package uploads prior to this one. | |
wait_for_previous_builds: | |
runs-on: ubuntu-20.04 | |
needs: upload_to_release | |
steps: | |
- name: checkout version | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- uses: ahmadnassri/action-workflow-queue@v1 | |
with: | |
delay: 30000 # 30 seconds between retries | |
timeout: 5400000 # 1.5 hour total timeout | |
############## handle the creasion of the full package installation ############## | |
full_package: | |
runs-on: ubuntu-20.04 | |
needs: [version_and_changelog, wait_for_previous_builds] | |
steps: | |
- name: checkout version | |
uses: actions/checkout@v2 | |
- id: romfs_version | |
uses: pozetroninc/github-action-get-latest-release@master | |
with: | |
repository: HDR-Development/romfs-release | |
- name: make package | |
run: | | |
python3 scripts/full_package.py ${{ needs.version_and_changelog.outputs.version }} ${{ steps.romfs_version.outputs.release }} | |
# get the most recent latest full release | |
- id: package_latest | |
uses: pozetroninc/github-action-get-latest-release@master | |
with: | |
repository: HDR-Development/HDR-Nightlies | |
# build the upgrade.zip and deletions.json | |
- name: make upgrade artifacts | |
run: | | |
python3 scripts/make_diff.py nightly | |
- name: show upgrade artifacts | |
run: | | |
ls && stat * && echo && ls upgrade_artifacts && stat upgrade_artifacts/* | |
# upload the upgrade data to the previous release for auto updater | |
- name: Upload upgrade data to previous release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.RELEASE_TOKEN }} | |
file: upgrade_artifacts/upgrade.zip | |
prerelease: false | |
file_glob: true | |
asset_name: upgrade | |
repo_name: HDR-Development/HDR-Nightlies | |
tag: ${{ steps.package_latest.outputs.release }} | |
overwrite: true | |
# upload the upgrade data to the previous release for auto updater | |
- name: Upload upgrade deletions to previous release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.RELEASE_TOKEN }} | |
file: upgrade_artifacts/deletions.json | |
prerelease: false | |
file_glob: true | |
asset_name: deletions | |
repo_name: HDR-Development/HDR-Nightlies | |
tag: ${{ steps.package_latest.outputs.release }} | |
overwrite: true | |
- uses: actions/download-artifact@v3 | |
with: | |
name: changelog | |
- name: Display structure of downloaded changelog | |
run: ls -R && cp CHANGELOG.md artifacts | |
- uses: actions/download-artifact@v3 | |
with: | |
name: version | |
# build the lvd files | |
# - id: lvd_files | |
# uses: robinraju/[email protected] | |
# with: | |
# repository: "techyCoder81/SSBU-LVD-data-dump" | |
# tag: release | |
# fileName: "lvd_dumper.zip" | |
# - name: Setup dotnet | |
# uses: actions/setup-dotnet@v1 | |
# with: | |
# dotnet-version: '5.0.408' | |
# - name: extract lvd data | |
# id: lvd_extract | |
# shell: bash | |
# run: | | |
# . scripts/extract_lvd_data.sh | |
- name: Display structure of downloaded version | |
run: ls -R && cp hdr_version.txt artifacts | |
# - name: Push lvd file to Suddy's HDRStageTool | |
# uses: dmnemec/copy_file_to_another_repo_action@main | |
# env: | |
# API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB_HDRSTAGETOOL }} | |
# with: | |
# source_file: 'artifacts/lvd.zip' | |
# destination_folder: 'nightly' | |
# destination_repo: 'SuddyN/HDRStageTool' | |
# user_email: '[email protected]' | |
# user_name: 'SuddyN' | |
# destination_branch: 'gh-pages' | |
- name: Upload full package to nightlies | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.RELEASE_TOKEN }} | |
file: artifacts/* | |
prerelease: false | |
file_glob: true | |
asset_name: artifacts | |
repo_name: HDR-Development/HDR-Nightlies | |
release_name: ${{ needs.version_and_changelog.outputs.version }}-nightly | |
tag: ${{ needs.version_and_changelog.outputs.version }} | |
overwrite: true | |
body: ${{ needs.version_and_changelog.outputs.changelog }} | |
################ handle the creation of to-nightly.zip ################ | |
to_nightly: | |
runs-on: ubuntu-20.04 | |
needs: [full_package, version_and_changelog] | |
steps: | |
- name: checkout version | |
uses: actions/checkout@v2 | |
# get the nightly | |
- id: latest_nightly | |
uses: robinraju/[email protected] | |
with: | |
repository: "HDR-Development/HDR-Nightlies" | |
tag: ${{ needs.version_and_changelog.outputs.version }} | |
fileName: "switch-package.zip" | |
# move the nightly to the artifacts dir | |
- run: mkdir artifacts && mv switch-package.zip artifacts | |
# build the to-nightly.zip | |
- name: make to-nightly.zip artifact | |
run: | | |
python3 scripts/make_diff.py beta | |
- name: show upgrade artifacts | |
run: | | |
ls && stat * && echo && ls upgrade_artifacts && stat upgrade_artifacts/* | |
- run: mv upgrade_artifacts/upgrade.zip to-nightly.zip | |
- run: mv upgrade_artifacts/deletions.json to_nightly_deletions.json | |
# get the most recent latest beta | |
- id: latest_beta | |
uses: pozetroninc/github-action-get-latest-release@master | |
with: | |
repository: HDR-Development/HDR-Releases | |
# upload the to-nightly.zip to the beta for the launcher | |
- name: Upload to-nightly.zip to beta | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.RELEASE_TOKEN }} | |
file: to-nightly.zip | |
prerelease: false | |
file_glob: false | |
asset_name: to-nightly.zip | |
repo_name: HDR-Development/HDR-Releases | |
tag: ${{ steps.latest_beta.outputs.release }} | |
overwrite: true | |
# upload the to_nightly_deletions.json to the beta for the launcher | |
- name: Upload to_nightly_deletions.json to beta | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.RELEASE_TOKEN }} | |
file: to_nightly_deletions.json | |
prerelease: false | |
file_glob: false | |
asset_name: to_nightly_deletions.json | |
repo_name: HDR-Development/HDR-Releases | |
tag: ${{ steps.latest_beta.outputs.release }} | |
overwrite: true | |
################ handle the creation of to-beta.zip ################ | |
to_beta: | |
runs-on: ubuntu-20.04 | |
needs: [full_package, version_and_changelog] | |
steps: | |
- name: checkout version | |
uses: actions/checkout@v2 | |
# get the beta | |
- id: latest_beta | |
uses: robinraju/[email protected] | |
with: | |
repository: "HDR-Development/HDR-Releases" | |
latest: true | |
fileName: "switch-package.zip" | |
# move the beta to the artifacts dir | |
- run: mkdir artifacts && mv switch-package.zip artifacts | |
# build the to-beta.zip | |
- name: make to-beta.zip artifact | |
run: | | |
python3 scripts/make_diff.py https://github.com/HDR-Development/HDR-Nightlies/releases/download/${{ needs.version_and_changelog.outputs.version }}/switch-package.zip | |
- name: show upgrade artifacts | |
run: | | |
ls && stat * && echo && ls upgrade_artifacts && stat upgrade_artifacts/* | |
- run: mv upgrade_artifacts/upgrade.zip to-beta.zip | |
- run: mv upgrade_artifacts/deletions.json to_beta_deletions.json | |
# upload the to-beta.zip to the beta for the launcher | |
- name: Upload to-beta.zip to nightly | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.RELEASE_TOKEN }} | |
file: to-beta.zip | |
prerelease: false | |
file_glob: false | |
asset_name: to-beta.zip | |
repo_name: HDR-Development/HDR-Nightlies | |
tag: ${{ needs.version_and_changelog.outputs.version }} | |
overwrite: true | |
# upload the to_beta_deletions.json to the beta for the launcher | |
- name: Upload to_beta_deletions.json to nightly | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.RELEASE_TOKEN }} | |
file: to_beta_deletions.json | |
prerelease: false | |
file_glob: false | |
asset_name: to_beta_deletions.json | |
repo_name: HDR-Development/HDR-Nightlies | |
tag: ${{ needs.version_and_changelog.outputs.version }} | |
overwrite: true |