|
| 1 | +# This is a basic workflow that is manually triggered |
| 2 | + |
| 3 | +name: Update Site Version Number |
| 4 | + |
| 5 | +# Controls when the action will run. Workflow runs when manually triggered using the UI |
| 6 | +# or API. |
| 7 | +on: |
| 8 | + workflow_dispatch: |
| 9 | + release: |
| 10 | + types: [published] |
| 11 | + |
| 12 | +# A workflow run is made up of one or more jobs that can run sequentially or in parallel |
| 13 | +jobs: |
| 14 | + build: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v5 |
| 19 | + with: |
| 20 | + repository: FreeTubeApp/FreeTubeApp.io |
| 21 | + token: ${{ secrets.FLATHUB_TOKEN }} |
| 22 | + - name: Get Repo Release List |
| 23 | + uses: moustacheful/github-api-exec-action@v0 |
| 24 | + id: list_results |
| 25 | + with: |
| 26 | + # Command to execute, (e.g: `pulls.create`), see https://octokit.github.io/rest.js/ for available commands |
| 27 | + command: repos.listReleases |
| 28 | + payload: > |
| 29 | + { |
| 30 | + "owner": "FreeTubeApp", |
| 31 | + "repo": "FreeTube" |
| 32 | + } |
| 33 | + env: |
| 34 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 35 | + - name: Create Current Version Variable |
| 36 | + uses: bluwy/substitute-string-action@v3 |
| 37 | + id: current |
| 38 | + with: |
| 39 | + _input-text: ${{ fromJson(steps.list_results.outputs.result)[0].tag_name }} |
| 40 | + -beta: '' |
| 41 | + v: '' |
| 42 | + - name: Create Previous Version Variable |
| 43 | + uses: bluwy/substitute-string-action@v3 |
| 44 | + id: previous |
| 45 | + with: |
| 46 | + _input-text: ${{ fromJson(steps.list_results.outputs.result)[1].tag_name }} |
| 47 | + -beta: '' |
| 48 | + v: '' |
| 49 | + - name: Set Master Branch |
| 50 | + # Currently the default branch is master, but if that changes later, then this acts as a failsafe. |
| 51 | + run: | |
| 52 | + git checkout master |
| 53 | + - name: Update index.php |
| 54 | + run: | |
| 55 | + sed -i 's/${{ steps.previous.outputs.result }}/${{ steps.current.outputs.result }}/g' src/index.php |
| 56 | + - name: Commit Files |
| 57 | + uses: stefanzweifel/git-auto-commit-action@v6 |
| 58 | + with: |
| 59 | + # Optional but recommended |
| 60 | + # Defaults to "Apply automatic changes" |
| 61 | + commit_message: Update version number to v${{ steps.current.outputs.result }} |
| 62 | + |
| 63 | + # Optional options appended to `git-commit` |
| 64 | + # See https://git-scm.com/docs/git-commit for a list of available options |
| 65 | + commit_options: '--no-verify --signoff' |
| 66 | + |
| 67 | + # Optional: Disable dirty check and always try to create a commit and push |
| 68 | + skip_dirty_check: true |
0 commit comments