viperHTML / viperhtml.github.io

Showcase of the ${hyper,viper,native}HTML family
ISC License
27 stars 11 forks source link

Set the `GH_TOKEN` environment variable in `.travis.yml` #23

Closed ExE-Boss closed 6 years ago

ExE-Boss commented 6 years ago

Now that #22 has been merged, step 5 can be completed:

  1. Make a commit replacing the GH_TOKEN environment variable with an actual GitHub deploy token following this guide (⚠ MUST BE ENCRYPTED USING travis encrypt ⚠): https://github.com/viperHTML/viperhtml.github.io/blob/bfe1a7166474701d49064ac778b47110f8ab1685/.travis.yml#L4 and push the commit to the src branch (make sure to use the api.travis-ci.com API endpoint to get the encryption keys and not the legacy api.travis-ci.org API endpoint, otherwise Travis will fail to decrypt the GH_TOKEN).

Also, step 1 can be finished:

  1. …make [the src branch] the new default branch (*.github.io user/organisation sites can only be deployed from the master branch, not from the gh‑pages branch, like project GitHub Pages sites can).

This will make it so that the default view of the repository will show the website source, rather than the built result (which might eventually be post-processed and minified as much as they can be).

WebReflection commented 6 years ago

about the branch thing, this repo is configured to use master for the web, no gh-pages

WebReflection commented 6 years ago

but I am going to sleep and travis is not working as expected so no rush at all

WebReflection commented 6 years ago

so ... I've no idea how to move forward in here. There is no panel saying add deploy token anywhere in here.

ExE-Boss commented 6 years ago

You need to install the Travis command line application and run travis encrypt 'GH_TOKEN={replace this with an actual GitHub token with the repo permission}' and then paste the result into .travis.yml, overwriting line 4: https://github.com/viperHTML/viperhtml.github.io/blob/7b85044a045782dcc9e7873ab1b48f3c01b9ab74/.travis.yml#L4

WebReflection commented 6 years ago

and run travis encrypt 'GH_TOKEN={replace this with an actual GitHub token with the repo permission}'

I've actually run travis encrypt {the actual GitHub token} instead, without including GH_TOKEN= which I assumed was wrongly there ... is that correct?

If so, can you please verify all is good now? Thanks.

WebReflection commented 6 years ago

right ... something tells me it didn't work ...

[0K$ ./bin/build ../gh-pages

if [ $# -ge 1 ]; then
  dir=$1
  if [ ! -d "$basedir/$dir" ] || [ ! "$(ls -A "$basedir/$dir")" ]; then
    git clone -b master -v https://${GH_TOKEN}@github.com/viperHTML/viperhtml.github.io.git "$basedir/$dir"
  fi
  rm -rf "$basedir/$dir/*"
fi
Cloning into './bin/../../gh-pages'...
fatal: unable to access 'https://EOha0C3HdkKFv97pvBX8QZ7tUXu9QeTamoPuocpHjVTOZxychftqr3EsW9PaSIDjaFSPyKUUywCsf1w53q5NGP11EZpCvEq5bjISDAy5mQnPtB0+J7orVy8lQH5npsYWXSBMqOL6uBOiTWTsgWRVDyni6REeCy8ECEwqBsDIEfZp/1AE2YuWD7ASlUCOOsyWaJbnDuToYgZsm46YjCJoCGpmXR0xBtZvMSag2ruHXApoTPIP6KNfDXg/aVHgpoa+kEw89aiAg8+zHnGt8r4pFtd0z4mmqwVgR/1kRT321fUWVxC7194MMCkpgEMLQ8tGYyEmAIrRaPCnR4jFBeMTLJsnPKNjlFSw2tnMnqEVKkmqnxMmBGpAIEr2hHHqcHnG02PFrdKL8X0KTEmdlraAQH2GfaWDfRIO4krGYpJa2ggKEdhrktscYia7iB1rE2kMYd2y5SMo7jgCsxVok2gDBetjg0I+h37MHWsZth+CEuOeKzQDLAkQVnBbDKQwmr32r51WSsIVRSkns/5Hf5M32Sx/S+R+daLNELQlL/g6Obamv7fbAcoD19eEnIXwpNEaHIuspnLZH/JVWdnWHOsnHxbSSjQMrnCZ3ePfMvDqOzRZn3odx/KA3cvjvqTVHZABg7z1wRGnN6+gnVgiXwKIUYNX4AM8omle56/0ZiKj0hM=@github.com/viperHTML/viperhtml.github.io.git/': Could not resolve host: EOha0C3HdkKFv97pvBX8QZ7tUXu9QeTamoPuocpHjVTOZxychftqr3EsW9PaSIDjaFSPyKUUywCsf1w53q5NGP11EZpCvEq5bjISDAy5mQnPtB0+J7orVy8lQH5npsYWXSBMqOL6uBOiTWTsgWRVDyni6REeCy8ECEwqBsDIEfZp

travis_time:end:006a4feb:start=1536054507034959270,finish=1536054507054277857,duration=19318587

The command "./bin/build ../gh-pages" exited with 128.

Done. Your build exited with 1.
WebReflection commented 6 years ago

OK, it worked now

WebReflection commented 6 years ago

So ... travis-push-update was pointing at ../gh-pages but there's not such branch in here so now it's pointing at ../master ... is this correct?

TL;DR Travis has access but it's not updating anything when I change the layout

ExE-Boss commented 6 years ago

../gh-pages is the build directory, the important part is the -b flag passed to git clone (which is set to master).

If you wish to change the build directory to ../master, you’ll have to change it here too: https://github.com/viperHTML/viperhtml.github.io/blob/1125d876c02f77afdc0e9f15180dff01cbd30bb5/.travis.yml#L27

ExE-Boss commented 6 years ago

It seems like you encrypted the GH_TOKEN wrongly: https://travis-ci.com/viperHTML/viperhtml.github.io/jobs/143597439#L419

See the following to know how to do it correctly:

ExE-Boss commented 6 years ago

You need to add secure: between the - and first ' on this line: https://github.com/viperHTML/viperhtml.github.io/blob/1125d876c02f77afdc0e9f15180dff01cbd30bb5/.travis.yml#L4

WebReflection commented 6 years ago

so ... I've used the official way:

travis encrypt GH_TOKEN="validhextokengeneratedwithrepoaccessrights" --add

and 've no idea if anything is working at all, specially because the personal access tokens area says that token has never been used at all

ExE-Boss commented 6 years ago

Verified fixed: https://github.com/viperHTML/viperhtml.github.io/commit/97ec8e479544c65ff365083aa9b9aa87ec4d5281