2022-11-27 14:48:17 +00:00
|
|
|
|
# author: 0-8-4
|
|
|
|
|
# date: 24-11-2022 18:34 AEDT
|
2023-11-13 13:18:59 +00:00
|
|
|
|
# last_update: 13-11-2023 22:57 AEDT
|
2022-11-27 14:48:17 +00:00
|
|
|
|
#
|
|
|
|
|
# This script is used to automatically build docker image and
|
|
|
|
|
# push to DockerHub when every new release is published
|
|
|
|
|
|
2022-11-28 03:32:44 +00:00
|
|
|
|
name: DockerHub CI
|
2022-11-27 14:48:17 +00:00
|
|
|
|
|
|
|
|
|
on:
|
|
|
|
|
release:
|
|
|
|
|
types: [published]
|
|
|
|
|
workflow_dispatch:
|
|
|
|
|
|
|
|
|
|
env:
|
|
|
|
|
DOCKERHUB_REPO: o1si/miui-auto-tasks
|
|
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
|
build:
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
steps:
|
2023-11-13 13:18:59 +00:00
|
|
|
|
-
|
|
|
|
|
name: Set up python 3.11 run the program once to create the `/data`
|
|
|
|
|
uses: actions/setup-python@v4
|
|
|
|
|
with:
|
|
|
|
|
python-version: '3.11'
|
|
|
|
|
|
2023-11-15 13:07:29 +00:00
|
|
|
|
- name: Install pipreqs
|
2023-11-13 14:31:39 +00:00
|
|
|
|
run: |
|
2023-11-15 13:07:29 +00:00
|
|
|
|
pip install pipreqs
|
2023-11-13 14:31:39 +00:00
|
|
|
|
|
|
|
|
|
- name: Export requirements.txt
|
|
|
|
|
run: |
|
2023-11-15 13:07:29 +00:00
|
|
|
|
pipreqs . --encoding=utf8 --force
|
2023-11-13 14:31:39 +00:00
|
|
|
|
|
2023-11-13 13:18:59 +00:00
|
|
|
|
-
|
|
|
|
|
name: run the program once to create the `/data`
|
2023-11-13 14:31:39 +00:00
|
|
|
|
run: |
|
|
|
|
|
python3 miuitask.py
|
2023-11-13 13:18:59 +00:00
|
|
|
|
|
2022-11-27 14:48:17 +00:00
|
|
|
|
-
|
|
|
|
|
name: Set up QEMU
|
|
|
|
|
uses: docker/setup-qemu-action@v2
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
name: Set up Docker Buildx
|
|
|
|
|
uses: docker/setup-buildx-action@v2
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
name: Login to Docker Hub
|
|
|
|
|
uses: docker/login-action@v2
|
|
|
|
|
with:
|
2022-11-28 03:32:44 +00:00
|
|
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
|
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
2022-11-27 14:48:17 +00:00
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
name: Build and push
|
|
|
|
|
uses: docker/build-push-action@v3
|
|
|
|
|
with:
|
|
|
|
|
push: true
|
|
|
|
|
platforms: |
|
|
|
|
|
linux/amd64
|
|
|
|
|
linux/arm64
|
|
|
|
|
tags: |
|
|
|
|
|
${{ env.DOCKERHUB_REPO }}:latest
|
|
|
|
|
${{ env.DOCKERHUB_REPO }}:${{ github.event.release.tag_name }}
|
|
|
|
|
|