Skip to content

Build Images Template #14

Build Images Template

Build Images Template #14

Workflow file for this run

name: Build Images Template
on:
schedule:
- cron: '0 0 1 * *'
workflow_dispatch:
env:
UPLOAD_RELEASE: true
TZ: Asia/Shanghai
jobs:
build_images_template:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: 'Checkout codes'
uses: actions/checkout@v4
with:
# 获取最新的代码, 可以减少程序消耗
fetch-depth: 0
- name: Environment preparation
id: install
run: |
sudo apt-get update
sudo apt-get install -y libguestfs-tools rng-tools
echo "status=success" >> $GITHUB_OUTPUT
- name: Run Shell Script
id: build
if: steps.install.outputs.status == 'success'
run: |
sudo /usr/bin/bash custom_qcow2.sh
echo "status=success" >> $GITHUB_OUTPUT
- name: Generate release tag
id: tag
if: env.UPLOAD_RELEASE == 'true' && steps.build.outputs.status == 'success' && !cancelled()
run: |
echo "release_tag=$(date +"%Y%m%d")" >> $GITHUB_OUTPUT
echo "status=success" >> $GITHUB_OUTPUT
- name: 'Upload release'
uses: softprops/action-gh-release@v2
if: steps.tag.outputs.status == 'success' && !cancelled()
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
tag_name: ${{ steps.tag.outputs.release_tag }}
files: |
images_work/compress/*.qcow2
- name: 'Clean Up'
run: sudo rm -rf images_cache images_work