2024-11-05 01:52:21 +00:00
|
|
|
# Variables:
|
|
|
|
# - RUNNER_TAG: optional, defines on which runner the workflow will use, default ubuntu-latest
|
|
|
|
# - DYNAMIC_MANIFEST: optional, if set it will build the manifest from header.yml and module.yml files (json not yet supported)
|
|
|
|
# - MANIFEST_FILENAME: needed, the manifest name such as net.retrodeck.retrodeck.yaml
|
|
|
|
|
|
|
|
name: "Build Artifacts for RetroDECK main manifest"
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
|
2024-11-05 02:07:08 +00:00
|
|
|
env:
|
|
|
|
DATE: ${{ github.run_id }}
|
2024-11-05 01:52:21 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
|
2024-11-05 02:07:08 +00:00
|
|
|
Check-variables:
|
|
|
|
runs-on: ubuntu-latest
|
2024-11-05 01:52:21 +00:00
|
|
|
steps:
|
2024-11-05 02:07:08 +00:00
|
|
|
- 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
|
|
|
|
|
|
|
|
Building-project:
|
|
|
|
needs: Check-variables
|
2024-11-05 03:02:38 +00:00
|
|
|
runs-on: ubuntu-latest
|
2024-11-05 01:52:21 +00:00
|
|
|
|
2024-11-05 02:07:08 +00:00
|
|
|
steps:
|
2024-11-05 01:52:21 +00:00
|
|
|
- name: Clone repo
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
submodules: 'true'
|
|
|
|
token: ${{ secrets.TRIGGER_BUILD_TOKEN }}
|
|
|
|
|
|
|
|
- name: "Install dependencies"
|
2024-11-05 03:05:09 +00:00
|
|
|
uses: ./.github/workflows/build_artifacts.yml
|
2024-11-05 01:52:21 +00:00
|
|
|
|
2024-11-05 02:07:08 +00:00
|
|
|
- name: "Assembling manifest"
|
2024-11-05 01:52:21 +00:00
|
|
|
if: ${{ env.DYNAMIC_MANIFEST == 'true' }}
|
2024-11-05 02:07:08 +00:00
|
|
|
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
|
2024-11-05 01:52:21 +00:00
|
|
|
|
|
|
|
- name: "[DEBUG] Outputting manifest"
|
|
|
|
if: ${{ env.DYNAMIC_MANIFEST == 'true' }}
|
2024-11-05 02:07:08 +00:00
|
|
|
run: |
|
|
|
|
if [ -f "${{ env.MANIFEST_FILENAME }}" ]; then
|
|
|
|
cat "${{ env.MANIFEST_FILENAME }}"
|
|
|
|
else
|
|
|
|
echo "ERROR: manifest file not found: ${{ env.MANIFEST_FILENAME }}"
|
|
|
|
exit 1
|
|
|
|
fi
|
2024-11-05 01:52:21 +00:00
|
|
|
|
|
|
|
- name: "Build flatpak"
|
|
|
|
run: |
|
|
|
|
git config --global protocol.file.allow always
|
|
|
|
flatpak-builder --user --force-clean \
|
|
|
|
--install-deps-from=flathub \
|
|
|
|
--install-deps-from=flathub-beta \
|
2024-11-05 02:07:08 +00:00
|
|
|
--repo="${GITHUB_WORKSPACE}/artifacts-repo" \
|
|
|
|
"${GITHUB_WORKSPACE}/artifacts-build-dir" \
|
2024-11-05 01:52:21 +00:00
|
|
|
"${{ env.MANIFEST_FILENAME }}"
|
|
|
|
|
|
|
|
- name: "Exporting dir tree"
|
|
|
|
id: tree
|
2024-11-05 02:07:08 +00:00
|
|
|
run: |
|
|
|
|
tree -H ./ > ${GITHUB_WORKSPACE}/tree.html
|
|
|
|
echo "Directory tree exported to tree.html"
|
2024-11-05 01:52:21 +00:00
|
|
|
|
2024-11-05 02:07:08 +00:00
|
|
|
- name: "Create Artifact for RetroDECK"
|
|
|
|
run: |
|
2024-11-05 01:52:21 +00:00
|
|
|
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
|
2024-11-05 02:07:08 +00:00
|
|
|
|
|
|
|
- name: Upload Artifacts
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: RetroDECK-Artifacts
|
|
|
|
path: |
|
|
|
|
${GITHUB_WORKSPACE}/RetroDECK-Artifact.tar.gz
|
|
|
|
${GITHUB_WORKSPACE}/tree.html
|
2024-11-05 01:52:21 +00:00
|
|
|
|
|
|
|
- name: Set environment variable with current branch name
|
|
|
|
run: echo "GITHUB_REF_SLUG=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: Get branch name
|
|
|
|
id: branch_name
|
|
|
|
run: echo "BRANCH_NAME=$(echo $GITHUB_REF | sed 's|refs/heads/||')" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: Publish the artifacts in a new release
|
|
|
|
uses: ncipollo/release-action@v1
|
|
|
|
with:
|
2024-11-05 02:07:08 +00:00
|
|
|
tag: "${{ github.ref_name }}-${{ github.run_id }}"
|
2024-11-05 01:52:21 +00:00
|
|
|
body: |
|
|
|
|
# Release Notes
|
2024-11-05 02:07:08 +00:00
|
|
|
These are the artifacts for RetroDECK from ${{ github.repository }}, built from commit: ${{ github.repository }}@${{ github.sha }}.
|
2024-11-05 01:52:21 +00:00
|
|
|
On branch [${{ github.ref_name }}](https://github.com/${{ github.repository }}/tree/${{ github.ref_name }}).
|
2024-11-05 02:07:08 +00:00
|
|
|
artifacts: "${GITHUB_WORKSPACE}/RetroDECK-Artifact.tar.gz, ${GITHUB_WORKSPACE}/tree.html"
|
2024-11-05 01:52:21 +00:00
|
|
|
allowUpdates: true
|
|
|
|
makeLatest: true
|
2024-11-05 02:07:08 +00:00
|
|
|
token: ${{ secrets.TRIGGER_BUILD_TOKEN || secrets.GITHUB_TOKEN }}
|