Skip to content

Commit

Permalink
chore: use GitHub Actions to build and release
Browse files Browse the repository at this point in the history
  • Loading branch information
LussacZheng committed Dec 14, 2022
1 parent 00e94c1 commit de47d95
Show file tree
Hide file tree
Showing 14 changed files with 447 additions and 232 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,8 @@ trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false

[*.{yml,yaml}]
indent_size = 2

[*.{bat,cmd}]
end_of_line = crlf
83 changes: 83 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Build you-get.exe

on:
workflow_dispatch:
inputs:
you_get_tag:
description: "Tag name of the target you-get version"
required: true
default: "develop"
type: string
release_title:
description: "Title of this release"
required: true
default: "Unofficial Build {DATE} for {YOU_GET_VERSION}"
type: string

jobs:
build:
name: "Bundle you-get for Windows"
runs-on: windows-latest
strategy:
matrix:
python-version: [ "3.7", "3.8", "3.9", "3.10", "3.11" ]
arch: ["x86", "x64"]

steps:
- uses: actions/checkout@v3

- name: "Checkout `you-get`"
uses: actions/checkout@v3
with:
repository: "soimort/you-get"
path: "repository/you-get"
ref: ${{ inputs.you_get_tag }}

- name: "Set up Python ${{ matrix.python-version }}"
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.arch }}

- name: "Setup poetry"
uses: Gr1N/setup-poetry@v7

- name: "Build you-get.exe"
shell: pwsh
run: |
poetry install
poetry run python build.py -f
Move-Item -Path .temp\artifact_info.json -Destination dist
- uses: actions/upload-artifact@v3
with:
name: you-get_py${{ matrix.python-version }}_${{ matrix.arch }}
path: |
dist/*.zip
dist/artifact_info.json
release:
name: "Create release"
runs-on: ubuntu-latest
needs: build

steps:
- uses: actions/checkout@v3

- uses: actions/download-artifact@v3
with:
path: .ci

- name: "Generate release notes"
env:
PYTHONPATH: .
run: |
python scripts/ci/release_notes.py
- name: "Release"
uses: softprops/action-gh-release@v1
with:
files: .ci/**/*.zip
draft: true
name: ${{ inputs.release_title }}
body_path: scripts/ci/release_notes.md
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ devscripts/you-get.exe.zip
repository/you-get/

# PyInstaller
*.spec
build/you-get/
build/file_version_info.txt
.temp
## Ignore every file in "dist/" except "dist/released/.gitkeep"
dist/*
!dist/released/
dist/released/*
!dist/released/.gitkeep

## CI
scripts/ci/release_notes.md
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ git clone https://github.com/LussacZheng/you-get.exe.git
2. After initialization, run `build.bat` under virtualenv.

```shell
poetry run build.bat
poetry run python build.py
```

3. Find the executable in `dist/` directory.
Expand All @@ -87,7 +87,7 @@ To re-build after the new release of You-Get:
3. Re-run `build.bat` under virtualenv.

```shell
poetry run build.bat
poetry run python build.py
```

4. Find the executable in `dist/` directory.
Expand All @@ -102,7 +102,7 @@ See more information in [**doc**](https://github.com/LussacZheng/you-get.exe/tre

- [x] Introduce [Poetry](https://github.com/python-poetry/poetry) for dependency management.
- [x] Rewrite `build.bat` with Python.
- [ ] Use GitHub Action to build and release.
- [x] Use GitHub Action to build and release.

## License

Expand Down
8 changes: 4 additions & 4 deletions README_cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ you-get -k --debug https://your.video/url/here
python3 install-poetry.py
```

- [Git](https://git-scm.com/)
- [Git](https://git-scm.com/)

### 获取此项目

Expand All @@ -73,7 +73,7 @@ git clone https://github.com/LussacZheng/you-get.exe.git
2. 初始化完成后,在虚拟环境中运行 `build.bat`

```shell
poetry run build.bat
poetry run python build.py
```

3. 打包好的可执行文件为 `dist/` 文件夹下。
Expand All @@ -95,7 +95,7 @@ git clone https://github.com/LussacZheng/you-get.exe.git
3. 重新在虚拟环境中运行 `build.bat`

```shell
poetry run build.bat
poetry run python build.py
```

4. 打包好的可执行文件在 `dist/` 文件夹下。
Expand All @@ -110,7 +110,7 @@ git clone https://github.com/LussacZheng/you-get.exe.git

- [x] 引入 [Poetry](https://github.com/python-poetry/poetry) 用于依赖管理。
- [x] 用 Python 重写 `build.bat`
- [ ] 使用 GitHub Action 进行构建和发布。
- [x] 使用 GitHub Action 进行构建和发布。

## License

Expand Down
Loading

0 comments on commit de47d95

Please sign in to comment.