Update App Version #596
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 App Version' | |
| on: | |
| schedule: | |
| - cron: '0 2 * * *' | |
| workflow_dispatch: | |
| jobs: | |
| get-latest-app-version: | |
| name: 'Check App Updates' | |
| runs-on: 'ubuntu-latest' | |
| permissions: | |
| contents: 'write' | |
| pull-requests: 'write' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: 'bazarr' | |
| repo: 'linuxserver/bazarr' | |
| - name: 'cleanuparr' | |
| repo: 'cleanuparr/cleanuparr' | |
| hub: 'ghcr' | |
| strip_prefix: 'v' | |
| - name: 'flaresolverr' | |
| repo: 'flaresolverr/flaresolverr' | |
| - name: 'homarr' | |
| repo: 'homarr-labs/homarr' | |
| hub: 'ghcr' | |
| - name: 'profilarr' | |
| repo: 'santiagosayshey/profilarr' | |
| - name: 'jellyfin' | |
| repo: 'jellyfin/jellyfin' | |
| strip_prefix: 'v' | |
| - name: 'lidarr' | |
| repo: 'linuxserver/lidarr' | |
| - name: 'prowlarr' | |
| repo: 'linuxserver/prowlarr' | |
| - name: 'radarr' | |
| repo: 'linuxserver/radarr' | |
| - name: 'readarr' | |
| repo: 'linuxserver/readarr' | |
| allow_prerelease: true | |
| - name: 'sabnzbd' | |
| repo: 'linuxserver/sabnzbd' | |
| - name: 'sonarr' | |
| repo: 'linuxserver/sonarr' | |
| - name: 'tinymediamanager' | |
| repo: 'tinymediamanager/tinymediamanager' | |
| - name: 'transmission' | |
| repo: 'linuxserver/transmission' | |
| steps: | |
| - uses: 'actions/checkout@v4' | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.AUTO_UPDATE_PAT }} | |
| - name: 'Update AppVersion and ChartVersion' | |
| run: | | |
| # Set global script settings | |
| export ALLOW_PRERELEASE='${{ matrix.allow_prerelease }}' | |
| export STRIP_VERSION_PREFIX='${{ matrix.strip_prefix }}' | |
| # The script writes VERSION_TYPE (major|minor|patch) to $GITHUB_ENV. | |
| ./scripts/update_appversion.sh \ | |
| '${{ matrix.name }}' \ | |
| '${{ matrix.repo }}' \ | |
| '${{ matrix.hub }}' | |
| - name: 'Check for changes' | |
| id: changes | |
| run: | | |
| if [[ -n "$(git status --porcelain)" ]]; then | |
| echo "CHANGES_FOUND=true" >> $GITHUB_ENV | |
| git diff | |
| else | |
| echo "CHANGES_FOUND=false" >> $GITHUB_ENV | |
| fi | |
| - name: 'Set up Git' | |
| if: env.CHANGES_FOUND == 'true' | |
| run: | | |
| git config --global user.name "github-actions" | |
| git config --global user.email "github-actions@users.noreply.github.com" | |
| app_version=$(awk '/^appVersion:/ {print $2}' "./charts/${{ matrix.name }}/Chart.yaml") | |
| BRANCH_NAME="update-${{ matrix.name }}-${app_version}" | |
| COMMIT_MSG="New app version found for ${{ matrix.name }}" | |
| echo "BRANCH_NAME=$BRANCH_NAME" >> "$GITHUB_ENV" | |
| echo "COMMIT_MSG=$BRANCH_NAME" >> "$GITHUB_ENV" | |
| if [[ "$VERSION_TYPE" != "major" ]]; then | |
| echo "AUTOMERGE=true" >> "$GITHUB_ENV" | |
| fi | |
| - name: 'Create Pull Request' | |
| id: create-pr | |
| if: env.CHANGES_FOUND == 'true' | |
| uses: 'peter-evans/create-pull-request@v7' | |
| with: | |
| token: ${{ secrets.AUTO_UPDATE_PAT }} | |
| commit-message: ${{ env.COMMIT_MSG }} | |
| title: "猸愶笍 New App Version: Update ${{ matrix.name }}" | |
| body: 'Automated Workflow. New App Version found for Chart' | |
| branch: ${{ env.BRANCH_NAME }} | |
| base: ${{ github.event.repository.default_branch }} | |
| - name: 'Enable auto-merge for non-major bumps' | |
| if: env.AUTOMERGE == 'true' && steps.create-pr.outputs.pull-request-number | |
| env: | |
| GH_TOKEN: ${{ secrets.AUTO_UPDATE_PAT }} | |
| PR_NUMBER: ${{ steps.create-pr.outputs.pull-request-number }} | |
| run: gh pr merge --auto --squash "$PR_NUMBER" |