1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-27 18:02:17 +03:00

Transition from TravisCI to GitHub CI (#7444)

Convert the continuous integration process to use GitHub's internal
CI cloud.  Allows us to run up to 20 jobs in parallel, speeding up
CI immensely.  Keep a short Travis-CI run, too, just for sanity and backup.

Uses new keys and secret when publishing a release to
esp8266.github.io.
This commit is contained in:
Earle F. Philhower, III
2020-07-14 22:02:47 -07:00
committed by GitHub
parent f8091311a3
commit 3bd24587e1
11 changed files with 442 additions and 173 deletions

Binary file not shown.

View File

@ -1,33 +1,25 @@
#!/bin/bash
#set -x
# Extract the release name from a release
ver=`git describe --tag`
# Default to draft tag name
ver=$(basename $(jq -e -r '.ref' "$GITHUB_EVENT_PATH"))
# If not available, try the publish tag name
if [ "$ver" == "null" ]; then
ver=$(jq -e -r '.release.tag_name' "$GITHUB_EVENT_PATH")
fi
# Fall back to the git description OTW (i.e. interactive)
if [ "$ver" == "null" ]; then
ver=$(git describe --tag)
fi
visiblever=$ver
# match 0.0.*
if [ "${ver%.*}" = 0.0 ]; then
plainver=$ver
# Match 0.0.* as special-case early-access builds
if [ "${ver%.*}" = 0.0 ]; then
git tag -d ${ver}
ver=`git describe --tag HEAD`
plain_ver=$ver
else
# Extract next version from platform.txt
next=`sed -n -E 's/version=([0-9.]+)/\1/p' ../platform.txt`
# Figure out how will the package be called
ver=`git describe --exact-match`
if [ $? -ne 0 ]; then
# not tagged version; generate nightly package
date_str=`date +"%Y%m%d"`
is_nightly=1
plain_ver="${next}-nightly"
ver="${plain_ver}+${date_str}"
else
plain_ver=$ver
fi
visiblever=$ver
fi
set -e

View File

@ -1,32 +1,36 @@
#!/bin/bash
#
# This script updates package index hosted on esp8266.github.io (aka arduino.esp8266.com).
# Normally is run by Travis CI for tagged versions, as a deploy step.
tag=`git describe --tags`
tag=$(jq -r '.release.tag_name' "$GITHUB_EVENT_PATH")
if [ "$tag" == "" ]; then
tag=`git describe --tags`
fi
cd $(dirname "$0")
# Decrypt and install SSH private key.
# "encrypted_xxx_key" and "encrypted_xxx_iv" are environment variables
# known to Travis CI builds.
openssl aes-256-cbc -K $encrypted_3a94a4db7dec_key -iv $encrypted_3a94a4db7dec_iv -in esp8266_github_io_deploy.enc -out esp8266_github_io_deploy -d
set -e # Abort with error if anything here does not go as expected!
# Install SSH private key from a GH Secret
echo $GHCI_DEPLOY_KEY | base64 -d > esp8266_github_io_deploy
eval "$(ssh-agent -s)"
chmod 600 esp8266_github_io_deploy
ssh-add esp8266_github_io_deploy
mkdir -p ~/.ssh
chmod go-w ~/.ssh
echo -e "Host github.com\nStrictHostKeyChecking no\n" >> ~/.ssh/config
chmod go-w ~/.ssh/config
# Clone the Github pages repository
git clone git@github.com:esp8266/esp8266.github.io.git
pushd esp8266.github.io
# Update the package index
cp ../versions/$tag/package_esp8266com_index.json stable/package_esp8266com_index.json
cp ../versions/*/package_esp8266com_index.json stable/package_esp8266com_index.json
git add stable/package_esp8266com_index.json
# Commit and push the changes
git config user.email "travis@travis-ci.org"
git config user.name "Travis CI"
git commit -m "update package index for release $tag"
git config user.email "github-ci-action@github.com"
git config user.name "GitHub CI Action"
git commit -m "Update package index for release $tag"
git push origin master
popd

30
package/upload_release.py Normal file
View File

@ -0,0 +1,30 @@
#!/usr/bin/env python3
from github import Github
import argparse
import collections
import glob
import json
import mimetypes
import os
parser = argparse.ArgumentParser(description='Upload a set of files to a new draft release')
parser.add_argument('--user', help="Github username", type=str, required=True)
parser.add_argument('--token', help="Github Personal Access Token (PAT)", type=str, required=True)
parser.add_argument('--repo', help="Repository", type=str, required=True)
parser.add_argument('--tag', help="Release tag", type=str, required=True)
parser.add_argument('--name', help="Release name", type=str, required=True)
parser.add_argument('--msg', help="Release message", type=str, required=True)
parser.add_argument('files', nargs=argparse.REMAINDER)
args = parser.parse_args()
if len(args.files) == 0:
print("ERROR: No files specified")
quit()
gh = Github(login_or_token=args.token)
repo = gh.get_repo(str(args.repo))
release = repo.create_git_release(args.tag, args.name, args.msg, draft=True)
for fn in args.files:
print("Uploading file: " + fn)
release.upload_asset(fn)