Pack and publish release builds (#300)

* pack release builds

* changes

* test

* more

* different unzip

* different unzip 2

* add pr artifacts action

* mm hashes

* add gc rom

* update linux sh

* fix windows linking

* give windows release a console

* tweaks
This commit is contained in:
Archez
2024-05-22 09:05:03 -05:00
committed by Garrett Cox
parent 7e0b22935a
commit 5a8989bdbe
10 changed files with 288 additions and 72 deletions
+34 -40
View File
@@ -17,7 +17,7 @@ jobs:
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y $(cat .github/workflows/apt-deps.txt)
sudo apt install -y $(cat .github/workflows/apt-deps.txt) file
- name: Install latest SDL
run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
@@ -34,22 +34,22 @@ jobs:
run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
cmake --no-warn-unused-cli -H. -Bbuild-cmake -GNinja -DCMAKE_BUILD_TYPE:STRING=Release
cmake --build build-cmake --config Release --target GenerateSohOtr -j
cmake --build build-cmake --config Release -j
# Not building releases/artifacts for now
# (cd build-cmake && cpack -G External)
# mv README.md readme.txt
# mv build-cmake/*.appimage 2ship.appimage
(cd build-cmake && cpack -G External)
mv README.md readme.txt
mv build-cmake/*.appimage 2ship.appimage
env:
CC: gcc
CXX: g++
# - name: Upload build
# uses: actions/upload-artifact@v3
# with:
# name: 2ship-linux-${{ matrix.archive-suffix }}
# path: |
# # 2ship.appimage
# readme.txt
- name: Upload build
uses: actions/upload-artifact@v4
with:
name: 2ship-linux
path: |
2ship.appimage
readme.txt
# build-windows:
# needs: generate-soh-otr-and-headers
# runs-on: windows-latest
@@ -122,17 +122,17 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: true
- name: Cache build folder
uses: actions/cache@v4
with:
save-always: true
key: ${{ runner.os }}-self-build-${{ github.ref }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-self-build-${{ github.ref }}
${{ runner.os }}-self-build-
path: |
build-windows
vcpkg
# - name: Cache build folder
# uses: actions/cache@v4
# with:
# save-always: true
# key: ${{ runner.os }}-self-build-${{ github.ref }}-${{ github.sha }}
# restore-keys: |
# ${{ runner.os }}-self-build-${{ github.ref }}
# ${{ runner.os }}-self-build-
# path: |
# build-windows
# vcpkg
- name: Configure Developer Command Prompt
uses: ilammy/msvc-dev-cmd@v1
- name: Copy Rom
@@ -143,22 +143,16 @@ jobs:
run: |
set $env:PATH="$env:USERPROFILE/.cargo/bin;$env:PATH"
cmake -S . -B build-windows -G Ninja -DCMAKE_MAKE_PROGRAM=ninja -DCMAKE_BUILD_TYPE:STRING=Release
cmake --build build-windows --config Release --target ExtractAssetHeaders --parallel 10
cmake --build build-windows --config Release --target GenerateSohOtr --parallel 10
cmake --build build-windows --config Release --parallel 10
# Not building releases/artifacts for now
# mkdir 2ship-windows
# mv ./x64/Release/mm.exe ./2ship-windows/2ship.exe
# mkdir 2ship-windows/debug
# mkdir 2ship-windows/mods
# New-Item 2ship-windows/mods/custom_otr_files_go_here.txt -type file
# mv ./x64/Release/2ship.pdb ./2ship-windows/debug/2ship.pdb
# mv ./README.md ./2ship-windows/readme.txt
# mv ./build-windows/gamecontrollerdb.txt ./2ship-windows/gamecontrollerdb.txt
# mv ./x64/Release/assets ./2ship-windows
# mv ./soh.otr ./2ship-windows/soh.otr
# - name: Upload build
# uses: actions/upload-artifact@v4
# with:
# name: 2ship-windows
# path: 2ship-windows
(cd build-windows && cpack)
cd ..
mv _packages/*.zip 2ship-windows.zip
- name: Unzip package
run: Expand-Archive -Path 2ship-windows.zip -DestinationPath 2ship-windows
- name: Upload build
uses: actions/upload-artifact@v4
with:
name: 2ship-windows
path: 2ship-windows
+61
View File
@@ -0,0 +1,61 @@
name: pr-artifacts
on:
workflow_run:
workflows: [generate-builds]
types:
- completed
jobs:
pr-artifacts:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.event == 'pull_request' }}
steps:
- id: 'pr-number'
uses: actions/github-script@v6
with:
result-encoding: string
script: |
const {owner, repo} = context.repo;
const pullHeadSHA = '${{github.event.workflow_run.head_sha}}';
const pullUserId = ${{github.event.sender.id}};
const prNumber = await (async () => {
const pulls = await github.rest.pulls.list({owner, repo});
for await (const {data} of github.paginate.iterator(pulls)) {
for (const pull of data) {
if (pull.head.sha === pullHeadSHA && pull.user.id === pullUserId) {
return pull.number;
}
}
}
})();
if (!prNumber) {
return core.error(`No matching pull request found`);
}
return prNumber;
- id: 'artifacts-text'
uses: actions/github-script@v6
with:
result-encoding: string
script: |
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.payload.workflow_run.id,
});
return allArtifacts.data.artifacts.reduce((acc, item) => {
if (item.name === "assets") return acc;
acc += `
- [${item.name}.zip](https://nightly.link/${context.repo.owner}/${context.repo.repo}/actions/artifacts/${item.id}.zip)`;
return acc;
}, '### Build Artifacts');
- id: 'add-to-pr'
uses: garrettjoecox/pr-section@3.1.0
with:
repo-token: '${{ secrets.GITHUB_TOKEN }}'
pr-number: ${{ steps.pr-number.outputs.result }}
section-name: 'artifacts'
section-value: '${{ steps.artifacts-text.outputs.result }}'