-
Notifications
You must be signed in to change notification settings - Fork 3
111 lines (111 loc) · 3.49 KB
/
release.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
name: Release
on: [workflow_dispatch]
jobs:
release:
runs-on: ubuntu-latest
concurrency: release
environment:
name: pypi
url: https://pypi.org/p/codelimit
permissions:
id-token: write
contents: write
outputs:
version: ${{ steps.release.outputs.version }}
steps:
- name: 'Checkout sources'
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: 'Set up Python'
uses: actions/setup-python@v2
with:
python-version: '3.10'
- name: 'Set up Poetry'
uses: snok/install-poetry@v1
- name: 'Install dependencies'
run: poetry install --no-interaction --no-root
- name: 'Python Semantic Release'
id: release
uses: relekang/python-semantic-release@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: 'Update checkout'
run: |
git pull
if: steps.release.outputs.released == 'true'
- name: 'Build distribution'
run: poetry build
- name: 'Publish to PyPI'
uses: pypa/gh-action-pypi-publish@release/v1
if: steps.release.outputs.released == 'true'
- name: 'Update files'
uses: MathieuSoysal/[email protected]
with:
files: README.md
prefix: 'rev: '
with-checkout: false
version: ${{ steps.release.outputs.version }}
- name: 'Commit GitHub Action distribution'
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add README.md
git commit -m 'Update files' || true
- name: 'Push changes'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
force: true
release_binaries:
name: 'Release binaries'
needs: release
defaults:
run:
shell: bash
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: macos-latest
TARGET: macos
CMD_BUILD: |
poetry run pyinstaller --collect-submodules codelimit.languages \
-n codelimit -F codelimit/__main__.py
mv dist/codelimit dist/codelimit-macos
OUT_FILE_NAME: dist/codelimit-macos
- os: windows-latest
TARGET: windows
CMD_BUILD: |
poetry run pyinstaller --collect-submodules codelimit.languages \
-n codelimit --onefile -c codelimit/__main__.py
OUT_FILE_NAME: dist/codelimit.exe
- os: ubuntu-latest
TARGET: linux
CMD_BUILD: |
poetry run pyinstaller --collect-submodules codelimit.languages \
-n codelimit -F codelimit/__main__.py
mv dist/codelimit dist/codelimit-linux
OUT_FILE_NAME: dist/codelimit-linux
steps:
- name: 'Checkout sources'
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: 'Set up Python'
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: 'Install Poetry'
uses: snok/install-poetry@v1
- name: 'Install dependencies'
run: poetry install --no-interaction --no-root
- name: 'Build codelimit with pyinstaller for ${{matrix.TARGET}}'
run: ${{matrix.CMD_BUILD}}
- name: 'Release'
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ format('v{0}', needs.release.outputs.version) }}
files: |
${{ matrix.OUT_FILE_NAME }}