Skip to content

Merge pull request #2502 from HDR-Development/pre-release #10

Merge pull request #2502 from HDR-Development/pre-release

Merge pull request #2502 from HDR-Development/pre-release #10

name: build_prerelease
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/[email protected]
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/[email protected]
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/[email protected]
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/[email protected]
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/[email protected]
#- 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 }}-prerelease 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/[email protected]
with:
name: version
path: hdr_version.txt
- name: Upload distributions artifact
uses: actions/[email protected]
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/[email protected]
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 }}-prerelease
tag: ${{ needs.version_and_changelog.outputs.version }}
overwrite: true
body: ${{ needs.version_and_changelog.outputs.changelog }}
# wait for any previous prereleases 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/[email protected]
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/[email protected]
- id: romfs_version
uses: pozetroninc/github-action-get-latest-release@master
with:
token: ${{ secrets.RELEASE_TOKEN }}
repository: HDR-Development/romfs-release
- name: Download romfs
id: get_romfs
uses: dsaltares/fetch-gh-release-asset@master
with:
repo: 'HDR-Development/romfs-release'
version: 'tags/${{ steps.romfs_version.outputs.release }}'
file: 'romfs.zip'
token: ${{ secrets.RELEASE_TOKEN }}
- name: make package
run: |
python3 scripts/full_package.py ${{ needs.version_and_changelog.outputs.version }} none
# get the most recent latest full release
- id: package_latest
continue-on-error: true
uses: pozetroninc/github-action-get-latest-release@master
with:
repository: HDR-Development/HDR-PreReleases
# build the upgrade.zip and deletions.json
- name: make upgrade artifacts
if: steps.package_latest.outcome != 'failure'
run: |
python3 scripts/make_diff.py prerelease
- name: show upgrade artifacts
if: steps.package_latest.outcome != 'failure'
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
if: steps.package_latest.outcome != 'failure'
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-PreReleases
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
if: steps.package_latest.outcome != 'failure'
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-PreReleases
tag: ${{ steps.package_latest.outputs.release }}
overwrite: true
- uses: actions/[email protected]
with:
name: changelog
- name: Display structure of downloaded changelog
run: ls -R && cp CHANGELOG.md artifacts
- uses: actions/[email protected]
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: 'prerelease'
# destination_repo: 'SuddyN/HDRStageTool'
# user_email: '[email protected]'
# user_name: 'SuddyN'
# destination_branch: 'gh-pages'
- name: Upload full package to prereleases
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-PreReleases
release_name: ${{ needs.version_and_changelog.outputs.version }}-prerelease
tag: ${{ needs.version_and_changelog.outputs.version }}
overwrite: true
body: ${{ needs.version_and_changelog.outputs.changelog }}
################ handle the creation of to-prerelease.zip ################
to_prerelease:
runs-on: ubuntu-20.04
needs: [full_package, version_and_changelog]
steps:
- name: checkout version
uses: actions/[email protected]
# get the prerelease
- id: latest_prerelease
uses: robinraju/[email protected]
with:
repository: "HDR-Development/HDR-PreReleases"
tag: ${{ needs.version_and_changelog.outputs.version }}
fileName: "switch-package.zip"
# move the prerelease to the artifacts dir
- run: mkdir artifacts && mv switch-package.zip artifacts
# build the to-prerelease.zip
- name: make to-prerelease.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-prerelease.zip
- run: mv upgrade_artifacts/deletions.json to_prerelease_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-prerelease.zip to the beta for the launcher
- name: Upload to-prerelease.zip to beta
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.RELEASE_TOKEN }}
file: to-prerelease.zip
prerelease: false
file_glob: false
asset_name: to-prerelease.zip
repo_name: HDR-Development/HDR-Releases
tag: ${{ steps.latest_beta.outputs.release }}
overwrite: true
# upload the to_prerelease_deletions.json to the beta for the launcher
- name: Upload to_prerelease_deletions.json to beta
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.RELEASE_TOKEN }}
file: to_prerelease_deletions.json
prerelease: false
file_glob: false
asset_name: to_prerelease_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/[email protected]
# 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-PreReleases/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 prerelease
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-PreReleases
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 prerelease
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-PreReleases
tag: ${{ needs.version_and_changelog.outputs.version }}
overwrite: true