Compare commits

...

16 commits

7 changed files with 47 additions and 118 deletions

View file

@ -12,27 +12,37 @@ on:
MANIFEST_FILENAME:
required: true
type: string
DYNAMIC_MANIFEST:
required: false
type: string
default: "false"
env:
DATE: ${{ github.run_id }}
jobs:
Building-project:
runs-on: ubuntu-latest
steps:
- name: Generate a token for Rekku
if: ${{ github.repository == 'RetroDECK/RetroDECK' }}
id: generate-rekku-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ vars.REKKU_APP_ID }}
private-key: ${{ secrets.REKKU_PRIVATE_KEY }}
repositories: "RetroDECK,Cooker"
owner: "RetroDECK"
- name: Clone repo
uses: actions/checkout@v3
with:
submodules: 'true'
token: ${{ secrets.TRIGGER_BUILD_TOKEN }}
- name: "Install dependencies"
uses: ./.github/workflows/build_artifacts.yml
- name: "Assembling manifest"
if: ${{ env.DYNAMIC_MANIFEST == 'true' }}
if: ${{ inputs.DYNAMIC_MANIFEST == 'true' }}
run: |
if [ -f "${GITHUB_WORKSPACE}/automation_tools/assemble_manifest.sh" ]; then
/bin/bash "${GITHUB_WORKSPACE}/automation_tools/assemble_manifest.sh"
@ -42,25 +52,33 @@ jobs:
fi
- name: "[DEBUG] Outputting manifest"
if: ${{ env.DYNAMIC_MANIFEST == 'true' }}
if: ${{ inputs.DYNAMIC_MANIFEST == 'true' }}
run: |
if [ -f "${{ env.MANIFEST_FILENAME }}" ]; then
cat "${{ env.MANIFEST_FILENAME }}"
if [ -f "${{ inputs.MANIFEST_FILENAME }}" ]; then
cat "${{ inputs.MANIFEST_FILENAME }}"
else
echo "ERROR: manifest file not found: ${{ env.MANIFEST_FILENAME }}"
echo "ERROR: manifest file not found: ${{ inputs.MANIFEST_FILENAME }}"
exit 1
fi
- name: "Build flatpak"
run: |
# Pull the Docker image
docker pull ebassi/flathub:base
# Configure Git
git config --global protocol.file.allow always
flatpak-builder --user --force-clean \
--install-deps-from=flathub \
--install-deps-from=flathub-beta \
--repo="${GITHUB_WORKSPACE}/artifacts-repo" \
"${GITHUB_WORKSPACE}/artifacts-build-dir" \
"${{ env.MANIFEST_FILENAME }}"
# Run the flatpak build inside the Docker container
docker run --rm \
-v "${GITHUB_WORKSPACE}:/workspace" \
-w /workspace \
ghcr.io/retrodeck/retrodeck-builder:latest \
--force-clean \
--repo="/workspace/artifacts-repo" \
"/workspace/artifacts-build-dir" \
"${{ inputs.MANIFEST_FILENAME }}"
- name: "Exporting dir tree"
id: tree
run: |
@ -99,4 +117,4 @@ jobs:
artifacts: "${GITHUB_WORKSPACE}/RetroDECK-Artifact.tar.gz, ${GITHUB_WORKSPACE}/tree.html"
allowUpdates: true
makeLatest: true
token: ${{ secrets.TRIGGER_BUILD_TOKEN || secrets.GITHUB_TOKEN }}
token: ${{ steps.generate-rekku-token.outputs.token || secrets.TRIGGER_BUILD_TOKEN || secrets.GITHUB_TOKEN }}

View file

@ -1,47 +0,0 @@
name: "Install dependencies"
on:
workflow_dispatch:
workflow_call:
jobs:
install-dependencies:
runs-on: ubuntu-latest
steps:
- name: "Install dependencies"
run: |
echo "Starting dependency installation..."
# NOTE: this script is a copy and paste of automation_tools/install_dependencies.sh
# Please keep the original updated
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

@ -18,14 +18,14 @@ jobs:
- name: Set default values for UPSTREAM_REPO and TARGET_BRANCH if not set
run: |
# Use the current repository name if UPSTREAM_REPO is not set
: "${UPSTREAM_REPO:=${{ github.repository }} }"
: "${UPSTREAM_REPO:=${{ github.event.repository.name }}}"
: "${TARGET_BRANCH:=master}"
# Format the repository name for flathub
# Format the repository name for flathub, ensure no trailing spaces
UPSTREAM_REPO="https://github.com/flathub/${UPSTREAM_REPO}"
echo "UPSTREAM_REPO=$UPSTREAM_REPO" >> $GITHUB_ENV
echo "TARGET_BRANCH=$TARGET_BRANCH" >> $GITHUB_ENV
echo "UPSTREAM_REPO=${UPSTREAM_REPO}" >> $GITHUB_ENV
echo "TARGET_BRANCH=${TARGET_BRANCH}" >> $GITHUB_ENV
- name: Sync from Upstream Repository
run: |
@ -38,7 +38,6 @@ jobs:
git merge --strategy-option theirs --no-edit FETCH_HEAD
}
- name: Push changes if there are updates
env:
BRANCH_NAME: "sync-${{ github.run_id }}" # Temporary branch name for the PR

View file

@ -5,7 +5,8 @@ This repository serves as a library for storing common automation workflows and
## How to Use This Repository
1. **Copy Workflow Templates**
Copy the contents of the `workflow-templates` directory into the `.github/workflows` directory of the repository you want to automate. Edit any necessary variables to customize the workflows to your needs (details TBD).
Copy the contents of the `workflow-templates` directory into the `.github/workflows` directory of the repository you want to automate. Edit any necessary variables to customize the workflows to your needs. (details TBD).
**NOTE:** manifest name is mandatory!
2. **Copy Common Files**
Copy files such as `.gitignore` into the root directory of the target repository to ensure consistency in configuration and file management.

View file

@ -1,33 +0,0 @@
#!/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

@ -6,16 +6,11 @@ on:
- master
- main
workflow_call:
env:
MANIFEST_FILENAME: "name.manifest.manifest.yaml"
workflow_dispatch:
jobs:
install-dependencies:
uses: RetroDECK/components-template/.github/workflows/install_dependencies.yml@main
build-project:
needs: install-dependencies # Ensures this job only runs after install-dependencies
uses: RetroDECK/components-template/.github/workflows/build_artifacts.yml@main
with:
MANIFEST_FILENAME: ${{ env.MANIFEST_FILENAME }}
MANIFEST_FILENAME: "put.something.else.yaml"

View file

@ -2,14 +2,10 @@ name: "Sync with Upstream and Create PR"
on:
workflow_call:
workflow_dispatch:
schedule:
- cron: "30 0 * * *" # Run every day at 00:30 UTC (9:30 JST)
jobs:
Upstream-sync:
runs-on: ubuntu-latest
steps:
- name: "Sync with upstream"
uses: RetroDECK/components-template/.github/workflows/pr_from_upstream.yml@main
upstream-sync:
uses: RetroDECK/components-template/.github/workflows/pr_from_upstream.yml@main