Skip to content

Discover latest versions of apps #846

Discover latest versions of apps

Discover latest versions of apps #846

# Writes the latest version of all apps in files under latest-versions/.
name: Discover latest versions of apps
on:
# Allow manual trigger from the Actions tab:
# https://github.com/Automattic/matrix.wordpress.net/actions/workflows/latest-versions.yml
workflow_dispatch:
# Trigger everyday at 00:00 UTC
schedule: [ cron: '0 0 * * *' ]
jobs:
discover-version-element:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
# The ACCESS_TOKEN secret is defined at
# https://github.com/Automattic/matrix.wordpress.net/settings/secrets/actions
token: ${{ secrets.ACCESS_TOKEN }}
- name: Discover latest version
run: |
latest_version=$(curl -sL https://api.github.com/repos/vector-im/element-web/releases/latest | \
jq -r ".tag_name")
if [ $latest_version != "null" ]
then
echo $latest_version > latest-versions/element
fi
- name: Check for modified files
id: git-check
run: echo ::set-output name=modified::$([ -z "`git status --porcelain`" ] && echo "false" || echo "true")
- name: Assign version to environment variable
if: steps.git-check.outputs.modified == 'true'
run: echo 'ELEMENT_VERSION='$(cat latest-versions/element) >> $GITHUB_ENV
- name: Commit latest version
if: steps.git-check.outputs.modified == 'true'
run: |
git config --global user.name 'Team Orbit'
git config --global user.email '[email protected]'
git pull
git add .
git commit -m "Set Element latest version to ${{ env.ELEMENT_VERSION }}"
git push
discover-version-matrix-to:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
# The ACCESS_TOKEN secret is defined at
# https://github.com/Automattic/matrix.wordpress.net/settings/secrets/actions
token: ${{ secrets.ACCESS_TOKEN }}
- name: Discover latest version
run: |
latest_version=$(curl -sL https://api.github.com/repos/Automattic/matrix.to/releases/latest | \
jq -r ".tag_name")
if [ $latest_version != "null" ]
then
echo $latest_version > latest-versions/matrix.to
fi
- name: Check for modified files
id: git-check
run: echo ::set-output name=modified::$([ -z "`git status --porcelain`" ] && echo "false" || echo "true")
- name: Assign version to environment variable
if: steps.git-check.outputs.modified == 'true'
run: echo 'MATRIX_TO_VERSION='$(cat latest-versions/matrix.to) >> $GITHUB_ENV
- name: Commit latest version
if: steps.git-check.outputs.modified == 'true'
run: |
git config --global user.name 'Team Orbit'
git config --global user.email '[email protected]'
git pull
git add .
git commit -m "Set matrix.to latest version to ${{ env.MATRIX_TO_VERSION }}"
git push