ci: move imgtool publishing to GH workflows

Disable imgtool publishing on Travis; update scripts to work on both
Travis and GH; add GH workflow for publishing.

Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
This commit is contained in:
Fabio Utzig 2020-11-10 10:36:42 -03:00 committed by Fabio Utzig
parent 3236d75e70
commit c06694e25c
3 changed files with 36 additions and 9 deletions

23
.github/workflows/imgtool.yaml vendored Normal file
View File

@ -0,0 +1,23 @@
on:
push:
branches:
- master
jobs:
environment:
name: Publish imgtool releases
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install publishing packages
run: |
export PATH="$HOME/.local/bin:$PATH"
./ci/imgtool_install.sh
- name: Publish imgtool
env:
TWINE_TOKEN: ${{ secrets.TWINE_TOKEN }}
run: |
export PATH="$HOME/.local/bin:$PATH"
./ci/imgtool_run.sh

View File

@ -12,10 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
if [[ $TRAVIS_PULL_REQUEST != "false" || $TRAVIS_BRANCH != "master" ]]; then
echo "Either a PR or not \"master\" branch, exiting"
exit 0
if [[ $TRAVIS == "true" ]]; then
if [[ $TRAVIS_PULL_REQUEST != "false" || $TRAVIS_BRANCH != "master" ]]; then
echo "Either a PR or not \"master\" branch, exiting"
exit 0
fi
fi
pip3 install setuptools twine packaging
pip3 install --pre imgtool
pip3 install --pre imgtool --no-binary :all:

View File

@ -12,9 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
if [[ $TRAVIS_PULL_REQUEST != "false" || $TRAVIS_BRANCH != "master" ]]; then
echo "Either a PR or not \"master\" branch, exiting"
exit 0
if [[ $TRAVIS == "true" ]]; then
if [[ $TRAVIS_PULL_REQUEST != "false" || $TRAVIS_BRANCH != "master" ]]; then
echo "Either a PR or not \"master\" branch, exiting"
exit 0
fi
fi
IMGTOOL_VER_PREFIX="\+imgtool_version = "
@ -22,13 +24,13 @@ IMGTOOL_VER_FILE="imgtool/__init__.py"
DIST_DIR="dist"
if [[ -z "$TWINE_TOKEN" ]]; then
echo "\$TWINE_TOKEN must be set in travis settings"
echo "\$TWINE_TOKEN must be set in Travis or GH settings"
exit 0
fi
cd scripts/
last_release=$(pip show imgtool | grep "Version: " | cut -d" " -f2)
last_release=$(pip3 show imgtool | grep "Version: " | cut -d" " -f2)
repo_version=$(grep "imgtool_version = " imgtool/__init__.py | sed 's/^.* = "\(.*\)"/\1/g')
python3 ../ci/compare_versions.py --old $last_release --new $repo_version