Repo init

This commit is contained in:
XargonWan 2024-11-05 11:07:08 +09:00
parent 3f9456dabf
commit d774c2ee45
6 changed files with 113 additions and 33 deletions

View file

@ -6,23 +6,30 @@
name: "Build Artifacts for RetroDECK main manifest"
on:
push:
branches:
- master
workflow_dispatch:
env:
RUNNER_TAG: ${{ env.RUNNER_TAG || 'ubuntu-latest' }}
DATE: ${{ github.run_id }}
MANIFEST_FILENAME: ${{ env.MANIFEST_FILENAME || '' }}
jobs:
Building_project:
runs-on: ${{ env.RUNNER_TAG || 'ubuntu-latest' }}
Check-variables:
runs-on: ubuntu-latest
steps:
- name: Check MANIFEST_FILENAME is set
run: |
if [ -z "${{ env.MANIFEST_FILENAME }}" ]; then
echo "Error: MANIFEST_FILENAME is not set. This is required for the pipeline to run."
exit 1
fi
# Circumventing this bug: https://github.com/flatpak/flatpak-builder/issues/317
# - name: Remove stuck mounts
# run: sudo umount -f /home/ubuntu/solarus-runner/_work/RetroDECK-solarus/RetroDECK-solarus/.flatpak-builder/rofiles/*
# continue-on-error: true
Building-project:
needs: Check-variables
runs-on: ${{ env.RUNNER_TAG }}
steps:
- name: Clone repo
uses: actions/checkout@v3
with:
@ -30,16 +37,27 @@ jobs:
token: ${{ secrets.TRIGGER_BUILD_TOKEN }}
- name: "Install dependencies"
run: "automation_tools/install_dependencies.sh"
uses: RetroDECK/components-template/.github/workflows/install_dependencies.yml@main
- name: "Assembilng manifest"
- name: "Assembling manifest"
if: ${{ env.DYNAMIC_MANIFEST == 'true' }}
run: "/bin/bash ${GITHUB_WORKSPACE}/automation_tools/assemble_manifest.sh"
run: |
if [ -f "${GITHUB_WORKSPACE}/automation_tools/assemble_manifest.sh" ]; then
/bin/bash "${GITHUB_WORKSPACE}/automation_tools/assemble_manifest.sh"
else
echo "Manifest assembly script not found."
exit 1
fi
- name: "[DEBUG] Outputting manifest"
continue-on-error: true
if: ${{ env.DYNAMIC_MANIFEST == 'true' }}
run: cat ${{ env.MANIFEST_FILENAME }}
run: |
if [ -f "${{ env.MANIFEST_FILENAME }}" ]; then
cat "${{ env.MANIFEST_FILENAME }}"
else
echo "ERROR: manifest file not found: ${{ env.MANIFEST_FILENAME }}"
exit 1
fi
- name: "Build flatpak"
run: |
@ -47,22 +65,29 @@ jobs:
flatpak-builder --user --force-clean \
--install-deps-from=flathub \
--install-deps-from=flathub-beta \
--repo=${GITHUB_WORKSPACE}/artifacts-repo \
"${GITHUB_WORKSPACE}"/artifacts-build-dir \
--repo="${GITHUB_WORKSPACE}/artifacts-repo" \
"${GITHUB_WORKSPACE}/artifacts-build-dir" \
"${{ env.MANIFEST_FILENAME }}"
- name: "Exporting dir tree"
id: tree
run: tree -H ./ > ${GITHUB_WORKSPACE}/tree.html
run: |
tree -H ./ > ${GITHUB_WORKSPACE}/tree.html
echo "Directory tree exported to tree.html"
- name: Create Artifact for RetroDECK
- name: "Create Artifact for RetroDECK"
run: |
tar -czf ${GITHUB_WORKSPACE}/RetroDECK-Artifact.tar.gz -C ${GITHUB_WORKSPACE}/artifacts-build-dir .
hash=($(sha256sum ${GITHUB_WORKSPACE}/RetroDECK-Artifact.tar.gz))
echo $hash > ${GITHUB_WORKSPACE}/RetroDECK-Artifact-cooker.sha
mv -f RetroDECK-Artifact-cooker.* ${{ secrets.ARTIFACT_REPO }}
continue-on-error: true
timeout-minutes: 1440
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: RetroDECK-Artifacts
path: |
${GITHUB_WORKSPACE}/RetroDECK-Artifact.tar.gz
${GITHUB_WORKSPACE}/tree.html
- name: Set environment variable with current branch name
run: echo "GITHUB_REF_SLUG=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV
@ -71,21 +96,15 @@ jobs:
id: branch_name
run: echo "BRANCH_NAME=$(echo $GITHUB_REF | sed 's|refs/heads/||')" >> $GITHUB_ENV
- name: Get date
id: date
run: echo "DATE=$(date +'%d%m%y.%S')" >> $GITHUB_ENV
- name: Publish the artifacts in a new release
uses: ncipollo/release-action@v1
with:
tag: "${{ github.ref_name }}-${{ github.event.date || github.run_id }}"
tag: "${{ github.ref_name }}-${{ github.run_id }}"
body: |
# Release Notes
These are the artifacts for RetroDECK of {{ github.repository }}, built from commit: ${{ github.repository }}@${{ github.sha }}.
These are the artifacts for RetroDECK from ${{ github.repository }}, built from commit: ${{ github.repository }}@${{ github.sha }}.
On branch [${{ github.ref_name }}](https://github.com/${{ github.repository }}/tree/${{ github.ref_name }}).
artifacts: "RetroDECK-Artifact.tar.gz, tree.html"
artifacts: "${GITHUB_WORKSPACE}/RetroDECK-Artifact.tar.gz, ${GITHUB_WORKSPACE}/tree.html"
allowUpdates: true
makeLatest: true
token: ${{ secrets.TRIGGER_BUILD_TOKEN }}
continue-on-error: true
token: ${{ secrets.TRIGGER_BUILD_TOKEN || secrets.GITHUB_TOKEN }}

View file

@ -0,0 +1,19 @@
name: "Install dependencies"
on:
workflow_dispatch:
workflow_call:
jobs:
install-dependencies:
runs-on: ubuntu-latest
steps:
- name: "Install dependencies"
run: |
echo "Starting dependency installation..."
if [ -f "${GITHUB_WORKSPACE}/automation_tools/install_dependencies.sh" ]; then
/bin/bash "${GITHUB_WORKSPACE}/automation_tools/install_dependencies.sh"
else
echo "Dependency installation script not found."
exit 1
fi

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
build-dir/
.flatpak-builder/

View file

@ -0,0 +1,33 @@
#!/bin/bash
# This script is installing the required dependencies to correctly run the pipeline and build the flatpak
unset pkg_mgr
# rpm-ostree must be checked before dnf because a dnf (wrapper) command also works on rpm-ostree distros (not what we want)
for potential_pkg_mgr in apt pacman rpm-ostree dnf; do
command -v "$potential_pkg_mgr" &> /dev/null && pkg_mgr="$potential_pkg_mgr" && break
done
case "$pkg_mgr" in
apt)
sudo add-apt-repository -y ppa:flatpak/stable
sudo apt update
sudo apt install -y flatpak flatpak-builder p7zip-full xmlstarlet bzip2 curl jq
;;
pacman)
sudo pacman -Syu --noconfirm flatpak flatpak-builder p7zip xmlstarlet bzip2
;;
rpm-ostree)
echo "When using a distro with rpm-ostree, you shouldn't build directly on the host. Try using a distrobox."
exit 1
;;
dnf)
sudo dnf install -y flatpak flatpak-builder p7zip p7zip-plugins xmlstarlet bzip2 curl
;;
*)
echo "Package manager $pkg_mgr not supported. Please open an issue."
;;
esac
flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak remote-add --user --if-not-exists flathub-beta https://flathub.org/beta-repo/flathub-beta.flatpakrepo

View file

@ -0,0 +1,4 @@
#!/bin/bash
git fetch https://github.com/flathub/net.rpcs3.RPCS3 master # Fetch the latest changes from the remote master branch
git merge FETCH_HEAD # Merge the fetched changes into your current branch

3
flathub.json Normal file
View file

@ -0,0 +1,3 @@
{
"only-arches": ["x86_64"]
}