-
Notifications
You must be signed in to change notification settings - Fork 64
105 lines (89 loc) · 3.35 KB
/
CI.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
name: CI
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
tags:
- v*
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-18.04, windows-latest, macos-10.15 ]
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
with:
repository: wxy1343/aliyunpan
submodules: recursive
- uses: actions/setup-python@v2
with:
python-version: 3.9.7
- name: Declare some variables
id: vars
shell: bash
run: |
echo "::set-output name=sha_short::$(git rev-parse --short "$GITHUB_SHA")"
echo "##[set-output name=arch;]$(arch)"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pyinstaller
- name: get version
id: version
run: echo "##[set-output name=version;]$(python aliyunpan.py --version | cut -d ' ' -f3 | awk '$1=$1')"
- name: set tag name
id: tag
run: echo "##[set-output name=name;]$(echo v${{ steps.version.outputs.version }}-${{ steps.vars.outputs.sha_short }})"
- name: set application name
id: application
run: echo "##[set-output name=name;]$(echo aliyunpan-cli-${{ runner.os }}-$(arch)-${{ steps.tag.outputs.name }})"
- name: run pyinstaller
run: pyinstaller -F aliyunpan/main.py -n aliyunpan-cli
- run: |
chmod +x dist/*
tar -zcvf ${{ steps.application.outputs.name }}.tar.gz -C dist .
- uses: mukunku/[email protected]
id: checkTag
with:
tag: ${{ steps.tag.outputs.name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release
id: create_release
uses: actions/create-release@v1
if: ${{ steps.checkTag.outputs.exists == 'false' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.tag.outputs.name }}
release_name: aliyunpan-cli-${{ steps.tag.outputs.name }}
draft: false
prerelease: false
- name: Sleep for 10s
uses: juliangruber/sleep-action@v1
with:
time: 10s
- name: Gets latest created release info
id: latest_release_info
uses: jossef/[email protected]
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.latest_release_info.outputs.upload_url }}
asset_path: ${{ steps.application.outputs.name }}.tar.gz
asset_name: ${{ steps.application.outputs.name }}.tar.gz
asset_content_type: application/gzip