Skip to content

Commit

Permalink
ci: move imgtool publishing to GH workflows
Browse files Browse the repository at this point in the history
Disable imgtool publishing on Travis; update scripts to work on both
Travis and GH; add GH workflow for publishing.

Signed-off-by: Fabio Utzig <[email protected]>
  • Loading branch information
utzig committed Nov 10, 2020
1 parent 3236d75 commit c06694e
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 9 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/imgtool.yaml
Original file line number Diff line number Diff line change
@@ -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
10 changes: 6 additions & 4 deletions ci/imgtool_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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:
12 changes: 7 additions & 5 deletions ci/imgtool_run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,25 @@
# 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 = "
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
Expand Down

0 comments on commit c06694e

Please sign in to comment.