Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Script to download finished artifacts #25

Open
nedbat opened this issue Sep 5, 2015 · 12 comments
Open

Script to download finished artifacts #25

nedbat opened this issue Sep 5, 2015 · 12 comments

Comments

@nedbat
Copy link
Contributor

nedbat commented Sep 5, 2015

I wrote a Python program to download all the artifacts from the latest Appveyor build: https://bitbucket.org/ned/coveragepy/src/d14e44a86376ec95645584360501ab5afc70d26f/ci/download_appveyor.py?at=default

Maybe others will find it useful.

@jayvdb
Copy link
Contributor

jayvdb commented Oct 7, 2015

A very similar script also at
ionelmc/python-lazy-object-proxy@967e383

@ogrisel
Copy link
Owner

ogrisel commented Oct 7, 2015

I think it would be useful to submit one of those a as a PR for inclusion to the repo along with a new section to the README.md to explain the use cases for this script.

@ankostis
Copy link

ankostis commented Oct 2, 2016

Why not use twine to push artifacts to PyPI whenever the commit is tagged?

@ankostis
Copy link

ankostis commented Oct 2, 2016

Continuing my suggestion above about twine,
this is a sample appveyor.yml:

environment:
  PYPI_USER: "FOO"
  PYPI_PSWD:
    # See https://www.appveyor.com/docs/build-configuration/#secure-variables
    secure: <paste-your-encrypted-value>

#... regular build here

on_success:
  - ps: >-
      $cmtid = git rev-parse HEAD
      if (git describe --exact-match $cmtid) {
        twine upload -u PYPI_USER -p PYPI_PSWD dist/*
      }

Of course the situation becomes a bit more complex if gpg-signing is needed.

@jayvdb
Copy link
Contributor

jayvdb commented Oct 2, 2016

Why not use twine to push artifacts to PyPI whenever the commit is tagged?

Good idea.

@anthrotype
Copy link
Contributor

anthrotype commented Oct 18, 2016

@ankostis wouldn't it be better to simply check if APPVEYOR_REPO_TAG environment variable is true?
https://www.appveyor.com/docs/environment-variables/
git describe only works with annotated tags, not "lightweight" ones.

on_success:
  - ps: >-
      if ($env:APPVEYOR_REPO_TAG) {
        twine upload -u PYPI_USER -p PYPI_PSWD dist/*
      }

@anthrotype
Copy link
Contributor

also, I wonder if that ps snippet would be better placed under deploy_script: instead of on_success:?

@anthrotype
Copy link
Contributor

hmm, I noticed that if I use deploy_script to upload to PyPI, then Appveyor will skip the deployment to Github Releases which is also specified under its own deploy section.
So it looks like deploy_script will override any other deploy.

@jankatins
Copy link

JFYI: twine can now take passwords and usernames from environment variables without the need to use it in a command (and potentially leaking it on some CI services):

https://github.com/pypa/twine/blob/master/docs/changelog.rst

:feature:144 Retrieve configuration from the environment as a default.
Repository URL will default to TWINE_REPOSITORY
Username will default to TWINE_USERNAME
Password will default to TWINE_PASSWORD

@jankatins
Copy link

I had to use this to make it work with the new twine env variables:

on_success:
  - ps: >-
      if ($env:APPVEYOR_REPO_TAG -eq "true") {
        twine upload dist/*.whl
      }

Without the -eq "true" it would upload on every build :-(

@anthrotype
Copy link
Contributor

The twine-powershell snippet used to work for me, but now it started failing because it appears that twine is printing to stderr and powershell... understands that as a failure (LOL).

https://ci.appveyor.com/project/anthrotype/zopfli/build/1.0.21/job/4uefbbr3xn8s6r5a#L105

Anybody knows a workaround? Like rewriting that powershell code as normal batch cmd?
Or muting twine so it doesn't print to stderr?

thanks

@anthrotype
Copy link
Contributor

ok, I made it work by calling twine via cmd /c twine upload dist\*.whl 2>&1 so that cmd redirects stderr to stdout before powershell can even see it. Ugly, but works:

fonttools/py-zopfli@2d211eb

https://ci.appveyor.com/project/anthrotype/zopfli/build/job/gv6x233d02o8yuvr

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

No branches or pull requests

6 participants