name: Update
on:
workflow_dispatch:
schedule:
- cron: "0 1 * * *"
push:
branches: [ "master" ]
env:
CARGO_TERM_COLOR: always
jobs:
update-ca-certs:
runs-on: ubuntu-latest
outputs:
CANCEL: ${{ steps.check.outputs.CANCEL }}
steps:
- uses: actions/checkout@v4
- name: Show system info
id: check
run: |
w(){ eval $* || true; }
set -x
w uname -a ; w sleep 1
w ifconfig -a ; w sleep 1
w free -h || w free ; w sleep 1
w uptime ; w sleep 1
w cat /proc/cpuinfo ; w sleep 1
w rustc --version ; w sleep 1
w cargo --version ; w sleep 1
w rustup --version
# check cancel if pushed
if test "${{github.event_name}}" = "push"
then
if git log -1 | grep -F "auto-submit}"
then
echo "Skip any auto commit by bots"
echo "CANCEL=1" >> $GITHUB_OUTPUT
exit 0
fi
if git log -1 | grep -F "#NOCI"
then
echo "This commit Disable CI"
echo "CANCEL=2" >> $GITHUB_OUTPUT
exit 0
fi
else
true
fi
echo "CANCEL=0" >> $GITHUB_OUTPUT
- name: Cargo test
if: ${{ steps.check.outputs.CANCEL == '0' }}
run: cargo test --all-features
- name: Run update.sh for update CA list
if: ${{ steps.check.outputs.CANCEL == '0' }}
run: |
cd src/
bash update.sh
cd ..
- name: Make sure the post-run of source code can be compiled
if: ${{ steps.check.outputs.CANCEL == '0' }}
run: cargo test --all-features
- name: Push changes
if: ${{ steps.check.outputs.CANCEL == '0' }}
run: |
git config --global user.name github-actions && git config --global user.email github-actions@github.com
git add -A
if test "$(git status -s | wc -c)" -gt 0
then
bash bump-version.sh || true
cargo test --all-features
git add -A
else
true
fi
git commit -m "{auto-submit} Update Mozilla Root CAs" || true
git push origin master || true