Skip to content

尝试添加docker版本 #77

尝试添加docker版本

尝试添加docker版本 #77

Workflow file for this run

name: Publish the built software
on:
push:
tags:
- '*'
jobs:
linux_amd64:
name: Build for amd64
runs-on: ubuntu-20.04
steps:
- name: Extract Tag Name
id: extract_tag
run: echo "::set-output name=tag_name::${GITHUB_REF#refs/tags/}"
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: |
pip install -r requirements.txt
- name: Build the Flask Project
run: |
mkdir dist
pyinstaller -D app.py --add-data "./static:./static" --add-data "./templates:./templates" --static --distpath dist -n alys
- name: Package the Flask Project
run: |
mv dist/alys dist/alys_${{ steps.extract_tag.outputs.tag_name }}_linux_amd64
cd dist
tar -czf alys_${{ steps.extract_tag.outputs.tag_name }}_linux_amd64.tar.gz *
mv alys_${{ steps.extract_tag.outputs.tag_name }}_linux_amd64.tar.gz ~/alys_${{ steps.extract_tag.outputs.tag_name }}_linux_amd64.tar.gz
- name: Upload build result
uses: actions/upload-artifact@v3
with:
name: build-result
path: ~/alys_${{ steps.extract_tag.outputs.tag_name }}_linux_amd64.tar.gz
linux_arm64:
name: Build for arm64
runs-on: ubuntu-latest
steps:
- name: Extract Tag Name
id: extract_tag
run: echo "::set-output name=tag_name::${GITHUB_REF#refs/tags/}"
- name: Checkout code
uses: actions/checkout@v2
- name: build
uses: pguyot/arm-runner-action@v2
id: build_image
with:
copy_artifact_path: binary
base_image: raspios_lite_arm64:latest
commands: |
apt update
apt install python3 pip -y --fix-missing
pip install -r requirements.txt --break-system-packages
mkdir dist
mkdir binary
pyinstaller -D app.py --add-data "./static:./static" --add-data "./templates:./templates" --static --distpath dist -n alys
mv dist/alys dist/alys_${{ steps.extract_tag.outputs.tag_name }}_linux_arm64
cd dist
tar -czf alys_${{ steps.extract_tag.outputs.tag_name }}_linux_arm64.tar.gz *
mv alys_${{ steps.extract_tag.outputs.tag_name }}_linux_arm64.tar.gz ../binary/alys_${{ steps.extract_tag.outputs.tag_name }}_linux_arm64.tar.gz
- name: Upload build result
uses: actions/upload-artifact@v3
with:
name: build-result
path: binary
windows_x64:
name: Build for win_X64
runs-on: windows-latest
defaults:
run:
shell: bash
steps:
- name: Extract Tag Name
id: extract_tag
run: echo "::set-output name=tag_name::${GITHUB_REF#refs/tags/}"
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: |
pip install -r requirements.txt
- name: Build the Flask Project
run: |
mkdir dist
pyinstaller -D app.py --add-data "./static;./static" --add-data "./templates;./templates" --static --distpath dist -n alys
- name: Package the Flask Project
run: |
mv dist/alys dist/alys_${{ steps.extract_tag.outputs.tag_name }}_windows_x64
cd dist
tar -czf alys_${{ steps.extract_tag.outputs.tag_name }}_windows_x64.tar.gz *
mkdir binary
mv alys_${{ steps.extract_tag.outputs.tag_name }}_windows_x64.tar.gz ~/alys_${{ steps.extract_tag.outputs.tag_name }}_windows_x64.tar.gz
- name: Upload build result
uses: actions/upload-artifact@v3
with:
name: build-result
path: ~/alys_${{ steps.extract_tag.outputs.tag_name }}_windows_x64.tar.gz
release:
name: Creat release
needs: [ windows_x64,linux_arm64,linux_amd64 ]
runs-on: ubuntu-latest
steps:
- name: Extract Tag Name
id: extract_tag
run: echo "::set-output name=tag_name::${GITHUB_REF#refs/tags/}"
- name: Use Tag Name
run: |
echo "Tag name: ${{ steps.extract_tag.outputs.tag_name }}"
- name: Download back the built software
uses: actions/download-artifact@v3
with:
name: build-result
- name: Release software
uses: ncipollo/release-action@v1
with:
artifacts: "*"
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.extract_tag.outputs.tag_name }}