mirror of
https://github.com/RetroDECK/components-template.git
synced 2024-11-24 20:25:38 +00:00
121 lines
4.3 KiB
YAML
121 lines
4.3 KiB
YAML
# 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:
|
|
workflow_call:
|
|
inputs:
|
|
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: Prepearing environment
|
|
run: curl -s "https://raw.githubusercontent.com/RetroDECK/components-template/refs/heads/main/automation_tools/install_dependencies.sh" | /bin/bash
|
|
|
|
- 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 }}
|
|
owner: "RetroDECK"
|
|
|
|
- name: Clone repo
|
|
uses: actions/checkout@v4
|
|
with:
|
|
submodules: 'true'
|
|
|
|
- name: Configuring Git
|
|
run: |
|
|
git config --global protocol.file.allow always
|
|
git config --global user.name "Rekku"
|
|
git config --global user.email "rekku@retrodeck.net"
|
|
|
|
- name: "Assembling manifest"
|
|
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"
|
|
else
|
|
echo "Manifest assembly script not found."
|
|
exit 1
|
|
fi
|
|
|
|
- name: "[DEBUG] Outputting manifest"
|
|
if: ${{ inputs.DYNAMIC_MANIFEST == 'true' }}
|
|
run: |
|
|
if [ -f "${{ inputs.MANIFEST_FILENAME }}" ]; then
|
|
cat "${{ inputs.MANIFEST_FILENAME }}"
|
|
else
|
|
echo "ERROR: manifest file not found: ${{ inputs.MANIFEST_FILENAME }}"
|
|
exit 1
|
|
fi
|
|
|
|
- name: "Build flatpak"
|
|
run: |
|
|
flatpak-builder --user --force-clean \
|
|
--install-deps-from=flathub \
|
|
--install-deps-from=flathub-beta \
|
|
--repo=${GITHUB_WORKSPACE}/artifacts-repo \
|
|
"${GITHUB_WORKSPACE}/artifacts-build-dir" \
|
|
"${{ inputs.MANIFEST_FILENAME }}"
|
|
|
|
- name: "Exporting dir tree"
|
|
id: tree
|
|
run: |
|
|
tree .
|
|
tree -H ./ > ${GITHUB_WORKSPACE}/tree.html
|
|
echo "Directory tree exported to tree.html"
|
|
|
|
- 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.sha
|
|
|
|
- name: Upload Artifacts
|
|
uses: actions/upload-artifact@v4
|
|
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
|
|
|
|
- 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:
|
|
tag: "${{ github.ref_name }}-${{ github.run_id }}"
|
|
body: |
|
|
# Release Notes
|
|
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, RetroDECK-Artifact.sha"
|
|
allowUpdates: true
|
|
makeLatest: true
|
|
token: ${{ steps.generate-rekku-token.outputs.token || secrets.TRIGGER_BUILD_TOKEN || secrets.GITHUB_TOKEN }}
|