Update release.yml #10
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: Release | |
on: | |
push: | |
branches: | |
- master # 或者是您用于发布的任何分支 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: 获取版本号 | |
run: | | |
VERSION=$(cat module.prop | grep 'version' | sed 's/version=//') | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
- name: 打印版本号 | |
run: echo "提取的版本号为 ${{ env.VERSION }}" | |
- name: 压缩文件 | |
run: | | |
zip -r alist-ddns-go_${{ env.VERSION }}.zip ./* # 根据版本号命名压缩包 | |
- name: 创建 Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: v${{ env.VERSION }} # 使用提取的版本号作为标签名 | |
release_name: alist-ddns-go_${{ env.VERSION }} # 使用提取的版本号作为 Release 名称 | |
draft: false | |
prerelease: false | |
body: | | |
发布的详细信息 | |
- name: 上传 Release 文件 | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./alist-ddns-go_${{ env.VERSION }}.zip | |
asset_name: alist-ddns-go_${{ env.VERSION }}.zip | |
asset_content_type: application/zip |