v0.25.0 Beta #10
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Update Site Version Number | |
| on: | |
| workflow_dispatch: | |
| release: | |
| types: [published] | |
| permissions: {} | |
| jobs: | |
| build: | |
| name: 'Update Site Version Number' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 #v7.0.0 | |
| with: | |
| repository: FreeTubeApp/FreeTubeApp.io | |
| token: ${{ secrets.FLATHUB_TOKEN }} | |
| persist-credentials: true | |
| - name: Get releases | |
| id: releases | |
| shell: bash | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # Fetch 4 releases as filtering out drafts happens on the client side and we are unlikely to have more than 2 drafts open at the same time | |
| run: | | |
| tags="$(gh release list --repo "$GITHUB_REPOSITORY" --exclude-drafts --json tagName --limit 4)" | |
| { | |
| echo 'versions<<EOF' | |
| echo "$tags" | jq --compact-output 'map(.tagName | ltrimstr("v") | rtrimstr("-beta"))' | |
| echo EOF | |
| } >> "$GITHUB_OUTPUT" | |
| - 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: ${{ fromJson(steps.releases.outputs.versions)[0] }} | |
| PREVIOUS: ${{ fromJson(steps.releases.outputs.versions)[1] }} | |
| run: | | |
| sed -i "s/${PREVIOUS}/${CURRENT}/g" src/index.php | |
| - name: Commit and push | |
| shell: bash | |
| env: | |
| CURRENT: ${{ fromJson(steps.releases.outputs.versions)[0] }} | |
| run: | | |
| git fetch --depth=1 | |
| git add src/index.php | |
| git -c user.name='github-actions[bot]' \ | |
| -c user.email='41898282+github-actions[bot]@users.noreply.github.com' \ | |
| commit -m "Update version number to v$CURRENT" \ | |
| --no-verify --signoff | |
| git push --set-upstream origin master |