Update #1188
This file contains 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 | |
on: | |
schedule: | |
- cron: '30 12 * * *' | |
workflow_dispatch: | |
jobs: | |
update: | |
runs-on: ubuntu-latest | |
steps: | |
- run: curl -v https://api.github.com/rate_limit | |
- uses: tibdex/github-app-token@v2 | |
id: token | |
with: | |
app_id: ${{secrets.APP_ID}} | |
private_key: ${{secrets.APP_PRIVKEY}} | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{steps.token.outputs.token}} | |
- uses: dtolnay/rust-toolchain@stable | |
- name: Get Element Version | |
id: element | |
run: | | |
wget -O releases.json https://api.github.com/repos/vector-im/element-web/releases | |
latest=0.0.0 | |
for version in $(jq -r '.[].tag_name' releases.json | sed -E 's,^v,,' | grep --invert-match -- -rc); do | |
dpkg --compare-versions $version gt $latest && latest=$version | |
done | |
echo "::set-output name=version::$latest" | |
rm releases.json | |
- name: Update Element | |
run: | | |
sed -E -i Dockerfile \ | |
-e "s|^ENV ELEMENT_VERSION.*$|ENV ELEMENT_VERSION ${{steps.element.outputs.version}}|" | |
- name: Update Crates | |
run: cargo update | |
- name: Prepare Commit Message | |
id: commit | |
run: | | |
element= | |
git diff --quiet --exit-code Dockerfile || element=t | |
cargo= | |
git diff --quiet --exit-code Cargo.lock || cargo=t | |
if [ "$element" == t ] && [ "$cargo" == t ]; then | |
echo "::set-output name=msg::Update Element to ${{steps.element.outputs.version}} and run cargo update" | |
elif [ "$element" == t ]; then | |
echo "::set-output name=msg::Update Element to ${{steps.element.outputs.version}}" | |
elif [ "$cargo" == t ]; then | |
echo "::set-output name=msg::Run cargo update" | |
else | |
echo "::set-output name=msg::Oh No! CI created an empty commit!" | |
fi | |
- uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_message: "${{steps.commit.outputs.msg}}" | |
commit_user_name: "docker-element-bot[bot]" | |
commit_user_email: "[email protected]" | |
commit_author: "docker-element-bot[bot] <[email protected]>" |