forked from RetroDECK/RetroDECK
-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (78 loc) · 2.83 KB
/
flathub_push.yml
File metadata and controls
88 lines (78 loc) · 2.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: "Push branch to Flathub"
on:
workflow_dispatch:
inputs:
dry_run:
description: "Enable DRY RUN: Don't push to Flathub, just simulate the process"
type: boolean
required: false
default: false
push_local_branch:
description: "PUSH the TARGET BRANCH instead of the main branch (not recommended)"
type: boolean
required: false
default: false
jobs:
Pushing_branch_to_flathub:
runs-on:
- ubuntu-latest
steps:
- name: Checkout RetroDECK repository
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Install xmlstarlet
run: |
sudo apt-get update
sudo apt-get install -y xmlstarlet
xmlstarlet --version || true
- name: Preparing data to push
run: |
RUN_ARGS=""
if [ "${{ github.event.inputs.dry_run }}" = true ]; then
RUN_ARGS+="--dry-run "
echo "Dry-run enabled"
fi
if [ "${{ github.event.inputs.push_local_branch }}" = true ]; then
RUN_ARGS+="--local "
echo "Pushing local branch: ${{ github.ref_name }}"
else
echo "Pushing main branch from remote"
fi
automation_tools/flathub_push.sh $RUN_ARGS
env:
GIT_NAME: ${{ secrets.GITNAME }}
GIT_MAIL: ${{ secrets.GITMAIL }}
GH_TOKEN: ${{ secrets.FLATHUB_PUSH }}
Summary:
needs: Pushing_branch_to_flathub
runs-on: ubuntu-latest
if: always()
steps:
- name: Checkout RetroDECK repository
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Write Flathub push summary
run: |
set -e
file=net.retrodeck.retrodeck.metainfo.xml
release_version=""
if [ -f "$file" ]; then
release_version=$(sed -n 's/.*<release version="\([^"]*\)".*/\1/p' "$file" | head -n1 || true)
fi
# Fallback: read info file created by the push script in the workspace
if [ -z "$release_version" ] && [ -f "flathub_push_info.env" ]; then
# shellcheck disable=SC1091
source flathub_push_info.env || true
release_version="${COMPONENT_VERSION:-$release_version}"
fi
if [ -z "$release_version" ]; then
release_version="unknown"
fi
flathub_repo="https://github.com/flathub/net.retrodeck.retrodeck"
branch_url="$flathub_repo/tree/$release_version"
echo "### Flathub push summary" >> "$GITHUB_STEP_SUMMARY"
echo "* Component version used: **$release_version**" >> "$GITHUB_STEP_SUMMARY"
echo "* Flathub branch pushed: **$release_version**" >> "$GITHUB_STEP_SUMMARY"
echo "* Branch link: [$branch_url]($branch_url)" >> "$GITHUB_STEP_SUMMARY"