Skip to content

publish

publish #75

Workflow file for this run

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/project/ytdlmusic/${{ steps.vars.outputs.relase_tag }} | grep "Error code 404" || (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-latest']
python-version: [ '3.11' ]
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.12'
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-latest' }}
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.11'
- 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 '[email protected]'
- 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