forked from FreeTubeApp/FreeTube
-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (71 loc) · 2.69 KB
/
updateSite.yml
File metadata and controls
80 lines (71 loc) · 2.69 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
# This is a basic workflow that is manually triggered
name: Update Site Version Number
# Controls when the action will run. Workflow runs when manually triggered using the UI
# or API.
on:
workflow_dispatch:
release:
types: [published]
permissions: {}
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2
with:
repository: FreeTubeApp/FreeTubeApp.io
token: ${{ secrets.FLATHUB_TOKEN }}
persist-credentials: true
- name: Get Repo Release List
uses: moustacheful/github-api-exec-action@2135aaccb1220f81e6fa4f14c90cc20efba069fe #v0
id: list_results
with:
# Command to execute, (e.g: `pulls.create`), see https://octokit.github.io/rest.js/ for available commands
command: repos.listReleases
payload: >
{
"owner": "FreeTubeApp",
"repo": "FreeTube"
}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Current Version Variable
uses: bluwy/substitute-string-action@70ff0b17357670ffd3fee68e95b6de9963b66bad #v3.0.0
id: current
with:
_input-text: ${{ fromJson(steps.list_results.outputs.result)[0].tag_name }}
-beta: ''
v: ''
- name: Create Previous Version Variable
uses: bluwy/substitute-string-action@70ff0b17357670ffd3fee68e95b6de9963b66bad #v3.0.0
id: previous
with:
_input-text: ${{ fromJson(steps.list_results.outputs.result)[1].tag_name }}
-beta: ''
v: ''
- name: Set Master Branch
# Currently the default branch is master, but if that changes later, then this acts as a failsafe.
shell: bash
run: |
git checkout master
- name: Update index.php
shell: bash
env:
CURRENT: ${{ steps.current.outputs.result }}
PREVIOUS: ${{ steps.previous.outputs.result }}
run: |
sed -i "s/${PREVIOUS}/${CURRENT}/g" src/index.php
- name: Commit Files
uses: stefanzweifel/git-auto-commit-action@04702edda442b2e678b25b537cec683a1493fcb9 #v7.1.0
with:
# Optional but recommended
# Defaults to "Apply automatic changes"
commit_message: Update version number to v${{ steps.current.outputs.result }}
# Optional options appended to `git-commit`
# See https://git-scm.com/docs/git-commit for a list of available options
commit_options: '--no-verify --signoff'
# Optional: Disable dirty check and always try to create a commit and push
skip_dirty_check: true