-
-
Notifications
You must be signed in to change notification settings - Fork 36
151 lines (146 loc) · 5.2 KB
/
on-release-master.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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
name: release-master
permissions:
contents: write
on:
# release:
# types: [published]
# branches: [master]
push:
tags:
- "v*.*.*"
env:
RELEASE_UPLOAD_URL: "release_upload_url"
ASSET_EXTENSION: ".zip"
OUT_NAME_FILE: "TIDAL-Downloader-NG"
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v3
- name: Set up the environment
uses: ./.github/actions/setup-poetry-env
- name: Export tag
id: vars
run: echo tag=${GITHUB_REF#refs/*/} >> $GITHUB_OUTPUT
- name: Build and publish
run: |
source .venv/bin/activate
poetry version $RELEASE_VERSION
make build-and-publish
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
RELEASE_VERSION: ${{ steps.vars.outputs.tag }}
- name: GitHub Release
id: release_create
uses: softprops/action-gh-release@v1
with:
draft: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Output Release URL File
run: echo "${{steps.release_create.outputs.upload_url}}" > ${{env.RELEASE_UPLOAD_URL}}.txt
- name: Save Upload URL File for publish
uses: actions/upload-artifact@v1
with:
name: ${{env.RELEASE_UPLOAD_URL}}
path: ${{env.RELEASE_UPLOAD_URL}}.txt
deploy-docs:
needs: publish
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v3
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
run: poetry install --no-interaction --with docs
- name: Deploy documentation
run: poetry run mkdocs gh-deploy --force
compute:
runs-on: ubuntu-latest
outputs:
ASSET_EXTENSION: ${{ env.ASSET_EXTENSION }}
OUT_NAME_FILE: ${{ env.OUT_NAME_FILE }}
steps:
- name: Compute outputs
run: |
echo "ASSET_EXTENSION=${{ env.ASSET_EXTENSION }}" >> $GITHUB_OUTPUT
echo "OUT_NAME_FILE=${{ env.OUT_NAME_FILE }}" >> $GITHUB_OUTPUT
build-gui-and-upload-assets:
needs: ["publish", "compute"]
env:
ASSET_MIME: "application/zip"
strategy:
fail-fast: false
matrix:
#os: ["ubuntu-20.04", "windows-2019", "macos-11", "macos-13"]
include:
- os: "macos-11"
TARGET: "macos-11"
CMD_BUILD: >
brew install create-dmg &&
source .venv/bin/activate &&
poetry run make gui-macos &&
cd dist &&
pwd &&
echo zip -r ${{needs.compute.outputs.OUT_NAME_FILE}}${{needs.compute.outputs.ASSET_EXTENSION}} ${{needs.compute.outputs.OUT_NAME_FILE}}.dmg -x "*.DS_Store"
zip -r ${{needs.compute.outputs.OUT_NAME_FILE}}${{needs.compute.outputs.ASSET_EXTENSION}} ${{needs.compute.outputs.OUT_NAME_FILE}}.dmg/ -x "*.DS_Store"
# - os: "windows-2019"
# TARGET: "windows-2019"
# CMD_BUILD: pyinstaller -F -w -n clipster -i resources/clipster.ico cli.py
runs-on: ${{ matrix.os }}
steps:
- name: Check out
uses: actions/checkout@v3
- name: Set up python
uses: actions/setup-python@v4
with:
python-version: "3.11"
# architecture: "x64"
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
run: poetry install --no-interaction --all-extras --with dev
- name: Build with pyinstaller for ${{matrix.TARGET}}
run: ${{matrix.CMD_BUILD}}
- name: Load Release URL File from release job
uses: actions/download-artifact@v1
with:
name: ${{env.RELEASE_UPLOAD_URL}}
- name: Get Release File Name & Upload URL
id: get_release_info
shell: bash
run: |
value=`cat ${{env.RELEASE_UPLOAD_URL}}/${{env.RELEASE_UPLOAD_URL}}.txt`
echo ::set-output name=upload_url::$value
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
upload_url: ${{steps.get_release_info.outputs.upload_url}}
asset_path: ./dist/${{needs.compute.outputs.OUT_NAME_FILE}}${{needs.compute.outputs.ASSET_EXTENSION}}
asset_name: ${{needs.compute.outputs.OUT_NAME_FILE}}${{needs.compute.outputs.ASSET_EXTENSION}}
asset_content_type: ${{env.ASSET_MIME}}