Skip to content

fix pypi build - #6362

Merged
elulcao merged 1 commit into
masterfrom
fix/pypi
Oct 19, 2021
Merged

fix pypi build#6362
elulcao merged 1 commit into
masterfrom
fix/pypi

Conversation

@breuerfelix

Copy link
Copy Markdown
Collaborator

... we need to go another round :D the pipeline was not triggered when i tagged the repo

@elulcao

Signed-off-by: Felix Breuer <fbreuer@pm.me>
@breuerfelix
breuerfelix requested a review from elulcao October 18, 2021 06:59
@elulcao

elulcao commented Oct 18, 2021

Copy link
Copy Markdown
Collaborator

... we need to go another round :D the pipeline was not triggered when i tagged the repo

@elulcao

yes, I saw the build stage skipped.
It's suppose to build .14 as the version file indicates.
Let me check it
:)

@elulcao

elulcao commented Oct 18, 2021

Copy link
Copy Markdown
Collaborator

... we need to go another round :D the pipeline was not triggered when i tagged the repo

@elulcao

Hi @breuerfelix
I guess for the 'publish step' is skipped because this wasn鈥檛 a tagged push.
github.event_name == 'push' && startsWith(github.ref, 'refs/tags'

As my understanding we need to execute this steps by hand:

$ git commit --allow-empty -m "Publishing the release <release>"
$ git tag -a <release> -m "Version <version>"
$ git push --tags 

then, the pipeline will be triggered, but this time the PyPi part is being executed since we have a new tag;
but, this can be automated somehow.

I think that we could use this block instead:

name: PyPi

on:
  push:
    # <== Here comments can be removed 
    branches: [master] # Master is ok, we only bump versions in master

jobs:
  build:
    runs-on: ubuntu-latest
    name: Deploy to PyPi
    steps:
      - name: Checkout source
        uses: actions/checkout@v2
      - name: Setup Python
        uses: actions/setup-python@v2
        with:
          python-version: 3.x
      - name: Install build dependencies and requirements
        run: |
          pip install --upgrade pip sdist wheel
          pip install -r requirements.txt
      - name: Build the package
        run: python setup.py sdist bdist_wheel
      - name: Publish package
        # <== Here
        # comments can be removed 
        # github.repository == 'timgrossmann/InstaPy' protects from fork projects
        # github.event_name == 'push' in push to master
        if: github.repository == 'timgrossmann/InstaPy' && github.event_name == 'push')
        uses: pypa/gh-action-pypi-publish@master # <== Here Using master 
        with:
          user: __token__
          password: ${{ secrets.PYPI_TOKEN }}

@breuerfelix

breuerfelix commented Oct 19, 2021

Copy link
Copy Markdown
Collaborator Author

@elulcao well i tested the change i made this time on a fork and had a look if it triggers on a tag and everything works :)
we do not need the check of "timgrossmann/instapy" since it wont work on a fork anyways since they do not have the TOKEN in their repo :)

if we would do it like you suggested, it would try to publish the package everytime we push a change on master -> it would fail since we already published version x.

https://github.com/breuerfelix/InstaPy/runs/3935835018?check_suite_focus=true -> that is the run on my fork! it only failed because i have no token but it triggered when i tagged the repo :)

@elulcao
elulcao merged commit ee747fa into master Oct 19, 2021
@elulcao
elulcao deleted the fix/pypi branch October 19, 2021 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants