Docker Image CI #254
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: Docker Image CI | |
on: | |
# push: | |
# branches: [ "main" ] | |
schedule: | |
- cron: "0 2 * * *" | |
workflow_dispatch: | |
env: | |
UPDATE: false | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: check update | |
run: | | |
export update=false | |
chmod 777 check.sh | |
export update=$(./check.sh) | |
echo "UPDATE=$update" >> $GITHUB_ENV | |
- name: Login to DockerHub | |
if: ${{ env.UPDATE == 'true' }} | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build the Docker image | |
if: ${{ env.UPDATE == 'true' }} | |
run: | | |
docker build . --file Dockerfile --tag captain686/qbittorrent:latest | |
- name: Push Image To DockerHub | |
if: ${{ env.UPDATE == 'true' }} | |
run: docker push captain686/qbittorrent:latest | |
- name: git push | |
if: ${{ env.UPDATE == 'true' }} | |
run: | | |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config user.name "github-actions[bot]" | |
git add . | |
git commit -m "π $(cat qbittorrent-nox_version)" | |
- name: push changes | |
if: ${{ env.UPDATE == 'true' }} | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.PERSONAL_TOKEN }} |