VERSIONING: added versioning and CLI parameters

This commit is contained in:
Xargon 2022-05-18 23:10:32 +09:00
parent a62ac23da7
commit d7202e2df6
3 changed files with 57 additions and 13 deletions

View file

@ -108,19 +108,19 @@ jobs:
sudo flatpak-builder --user --force-clean --repo=$GITHUB_WORKSPACE/local retrodeck-flatpak-cooker net.retrodeck.retrodeck.yml sudo flatpak-builder --user --force-clean --repo=$GITHUB_WORKSPACE/local retrodeck-flatpak-cooker net.retrodeck.retrodeck.yml
sudo flatpak build-bundle $GITHUB_WORKSPACE/local RetroDECK.flatpak net.retrodeck.retrodeck sudo flatpak build-bundle $GITHUB_WORKSPACE/local RetroDECK.flatpak net.retrodeck.retrodeck
- name: Get date for artifacts # - name: Get date for artifacts
id: date # id: date
run: echo "::set-output name=date::$(date +'%Y%m%d_%H%M')" # run: echo "::set-output name=date::$(date +'%Y%m%d_%H%M')"
- name: Extract branch name # - name: Extract branch name
shell: bash # shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" # run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch # id: extract_branch
- name: Publish the flatpak in a new cooker release - name: Publish the flatpak in a new cooker release
uses: ncipollo/release-action@v1 uses: ncipollo/release-action@v1
with: with:
tag: "${{ steps.extract_branch.outputs.branch }}-${{ steps.date.outputs.date }}" tag: "$(flatpak run net.retrodeck.retrodeck -v)"
body: | body: |
# Release Notes (Cooker) # Release Notes (Cooker)
This is a cooker snapshot based on the commit: ${{ github.event.repository.full_name }}@${{github.sha}}. This is a cooker snapshot based on the commit: ${{ github.event.repository.full_name }}@${{github.sha}}.

View file

@ -60,6 +60,15 @@ cleanup-commands:
modules: modules:
- name: version-initialization
sources:
- type: shell
commands:
- mkdir -p ${FLATPAK_DEST}/retrodeck/
- VERSION="cooker" # REMEMBER TO CHANGE THE VERSION BEFORE PUBLISHING (AND UPDATE THE APPDATA)
- if [ $VERSION == "cooker" ]; then VERSION=$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')-$(date +'%Y%m%d_%H%M'); fi
- $VERSION >> ${FLATPAK_DEST}/retrodeck/version
- name: xmlstarlet - name: xmlstarlet
config-opts: config-opts:
- --disable-static-libs - --disable-static-libs
@ -963,7 +972,6 @@ modules:
- rm -rf /app/share/emulationstation/resources/systems/unix/es_systems.xml - rm -rf /app/share/emulationstation/resources/systems/unix/es_systems.xml
- cp es_systems.xml /app/share/emulationstation/resources/systems/unix/ - cp es_systems.xml /app/share/emulationstation/resources/systems/unix/
# These must be put in home folder, managed by retrodeck.sh # These must be put in home folder, managed by retrodeck.sh
- mkdir -p ${FLATPAK_DEST}/retrodeck/
- cp es_settings.xml ${FLATPAK_DEST}/retrodeck/es_settings.xml - cp es_settings.xml ${FLATPAK_DEST}/retrodeck/es_settings.xml
# Logo, res # Logo, res

View file

@ -3,15 +3,51 @@
# Steam Deck SD path: /run/media/mmcblk0p1 # Steam Deck SD path: /run/media/mmcblk0p1
# Create log # Create log
exec 3>&1 4>&2 # exec 3>&1 4>&2
trap 'exec 2>&4 1>&3' 0 1 2 3 # trap 'exec 2>&4 1>&3' 0 1 2 3
echo "$(date) : RetroDECK started" >&3 # echo "$(date) : RetroDECK started" >&3
exec 1>~/retrodeck/.retrodeck.log 2>&1 # exec 1>~/retrodeck/.retrodeck.log 2>&1
is_mounted() { is_mounted() {
mount | awk -v DIR="$1" '{if ($3 == DIR) { exit 0}} ENDFILE{exit -1}' mount | awk -v DIR="$1" '{if ($3 == DIR) { exit 0}} ENDFILE{exit -1}'
} }
for i in "$@"; do
case $i in
-h*|--help*)
echo "RetroDECK v"$(cat /var/config/retrodeck/version)
echo "
Usage:
flatpak run [FLATPAK-RUN-OPTION] net.retrodeck-retrodeck [ARGUMENTS]
Arguments:
-h, --help Print this help
-v, --version Print RetroDECK version
--reset Starts the initial RetroDECK installer (backup your data first!)
For flatpak run specific options please run: flatpak run -h
https://retrodeck.net
"
exit
;;
--version*|-v*)
cat /var/config/retrodeck/version
exit
;;
--reset)
rm -f ~/retrodeck/.lock
shift # past argument with no value
;;
-*|--*)
echo "Unknown option $i"
exit 1
;;
*)
;;
esac
done
# if we got the .lock file it means that it's not a first run # if we got the .lock file it means that it's not a first run
if [ ! -f ~/retrodeck/.lock ] if [ ! -f ~/retrodeck/.lock ]
then then