-
Notifications
You must be signed in to change notification settings - Fork 3
158 lines (146 loc) · 4.99 KB
/
publish.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
152
153
154
155
156
name: publish
on:
workflow_dispatch:
jobs:
verify_version:
name: verify version is not already psuhed
runs-on : ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Deduce relase
id: vars
run: echo ::set-output name=relase_tag::$(grep version setup.py | cut -d "\"" -f2)
- name: Test pypi
run: |
curl -iL https://pypi.org/rss/project/ytdlmusic/releases.xml | grep -q "https://pypi.org/project/ytdlmusic/${{ steps.vars.outputs.relase_tag }}" && (echo "La release ${{ steps.vars.outputs.relase_tag }} existe deja." ; exit 1)
echo "La release ${{ steps.vars.outputs.relase_tag }} n'existe pas encore. Poursuite du traitement."
full_test_package:
needs: verify_version
strategy:
fail-fast: false
matrix:
os-version: ['ubuntu-22.04','macos-14']
python-version: [ '3.12' ]
include:
- os-version: 'ubuntu-22.04'
python-version: '3.8'
- os-version: 'ubuntu-22.04'
python-version: '3.9'
- os-version: 'ubuntu-22.04'
python-version: '3.10'
- os-version: 'ubuntu-22.04'
python-version: '3.11'
runs-on: ${{ matrix.os-version }}
name: test package on ${{ matrix.os-version }} with ${{ matrix.python-version }}
steps:
#preparation
- name: checkout
uses: actions/checkout@v2
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- name: install md5sum for macos
if: ${{ matrix.os-version == 'macos-14' }}
run: |
brew install md5sha1sum
- name: update pip
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools
#installation
- name: install ytdlmusic
run: |
pip install .
#configuration
- name: install ffmpeg with token
uses: FedericoCarboni/setup-ffmpeg@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
#test 1
#- name: Launch minimal test
# uses: ./.github/actions/minimal_test
#test 2
#- name: Launch full test
# uses: ./.github/actions/full_test
push:
needs: full_test_package
name: push package on pypi
runs-on: ubuntu-22.04
environment:
name: pypi
url: https://pypi.org/project/ytdlmusid/
permissions:
id-token: write
steps:
- name: checkout
uses: actions/checkout@v2
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: '3.12'
- name: update pip
run: |
python3 -m pip install --upgrade pip
- name: install pep517
run: |
pip install pep517
- name: build
run: python3 -m pep517.build --source --binary --out-dir dist/ .
- name: publish to pypi
uses: pypa/gh-action-pypi-publish@release/v1
commit:
needs: push
name: copy test to test_published
runs-on: ubuntu-22.04
steps:
- name: checkout
uses: actions/checkout@v2
- name: git version
run: |
git --version
git config --global user.name '$GITHUB_ACTOR'
git config --global user.email '$GITHUB_ACTOR@users.noreply.github.com'
- name: copy
run: |
cp .github/actions/full_test/action.yaml .github/actions/full_test_published/action.yaml
cp .github/actions/minimal_test/action.yaml .github/actions/minimal_test_published/action.yaml
- name: commit push
run: |
git status
git commit -am "TEST : maj test to test_published" || echo "nothing to commit"
git push || echo "nothing to push"
tag:
name: tag the release
needs: commit
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@master
- name: Deduce relase
id: vars
run: echo ::set-output name=relase_tag::$(grep version setup.py | cut -d "\"" -f2)
- name: Create a Release
uses: elgohr/Github-Release-Action@v4
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
with:
args: ${{ steps.vars.outputs.relase_tag }}
# tweet:
# name: tweet the release
# needs: tag
# runs-on: ubuntu-20.04
# steps:
# - name: checkout
# uses: actions/checkout@v2
# - name: Deduce relase
# id: vars
# run: echo ::set-output name=relase_tag::$(grep version setup.py | cut -d "\"" -f2)
# - name: tweet
# env:
# CONSUMER_KEY: ${{ secrets.CONSUMER_KEY }}
# CONSUMER_SECRET: ${{ secrets.CONSUMER_SECRET }}
# ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
# ACCESS_TOKEN_SECRET: ${{ secrets.ACCESS_TOKEN_SECRET }}
# VERSION: ${{ steps.vars.outputs.relase_tag }}
# run: pip install twython && python .github/publish_tweet.py