diff --git a/.github/workflows/release-build-and-push-to-GH-releases.yml b/.github/workflows/release-build-and-push-to-GH-releases.yml new file mode 100644 index 000000000..560f8db2b --- /dev/null +++ b/.github/workflows/release-build-and-push-to-GH-releases.yml @@ -0,0 +1,78 @@ +# +# Copyright (c) 2012-2020 Red Hat, Inc. +# This program and the accompanying materials are made +# available under the terms of the Eclipse Public License 2.0 +# which is available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +# +# Contributors: +# Red Hat, Inc. - initial API and implementation +name: Create release and push to github pages +on: + # Trigger the workflow on push only for the master branch + push: + branches: + - '7*' # Push events to matching 7.* branches + - 'master' +jobs: + build-and-deploy: + runs-on: ubuntu-20.04 + steps: + - name: Checkout + uses: actions/checkout@v2.3.1 + with: + persist-credentials: false + - uses: actions/setup-node@v1 + with: + node-version: '12' + - name: Generate tag utilities + id: TAG_UTIL + run: | + echo "::set-output name=gh_tag::$(date +'%Y%m%d%H%M%S')" + if [[ ${GITHUB_REF#refs/heads/} =~ 7.* ]]; + then + echo "::set-output name=chectl_version::$(cat VERSION)" + echo "::set-output name=gh_release_name::$(cat VERSION)" + fi + if [[ ${GITHUB_REF#refs/heads/} =~ master ]]; + then + CURRENT_DAY=$(date +'%Y%m%d') + SHORT_SHA1=$(git rev-parse --short HEAD) + export CHECTL_VERSION=0.0.$CURRENT_DAY-next + echo "::set-output name=chectl_version::0.0.$CURRENT_DAY-next" + echo "::set-output name=gh_release_name::0.0.$CURRENT_DAY-next.$SHORT_SHA1" + fi + - name: Install chectl dependencies + run: yarn + - name: Run unit tests + run: yarn test + - name: Pack chectl + run: | + git config --local user.name {{ github.actor }} + + sed -i "s#version\":\ \"\(.*\)\",#version\":\ \"${{ steps.TAG_UTIL.outputs.chectl_version }}\",#g" package.json + git tag ${{ steps.TAG_UTIL.outputs.gh_tag }} + + TARGETS=linux-arm,linux-x64,linux-s390x,linux-ppc64le,darwin-x64,win32-x64,win32-x86 + npx oclif-dev pack --targets=$TARGETS + + git clone https://github.com/che-incubator/chectl -b gh-pages --single-branch gh-pages + rm -rf gh-pages/.git + echo $(date +%s) > gh-pages/update + env + - name: Deploy to github pages + uses: JamesIves/github-pages-deploy-action@3.7.1 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + BRANCH: gh-pages + FOLDER: gh-pages + CLEAN: true # Automatically remove deleted files from the deploy branch + - name: Create Release and push artifacts + uses: softprops/action-gh-release@v1 + with: + name: ${{ steps.TAG_UTIL.outputs.gh_release_name }} + tag_name: ${{ steps.TAG_UTIL.outputs.gh_tag }} + files: "./dist/channels/**/chectl-*.gz" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release-stable-PRs.yml similarity index 94% rename from .github/workflows/release.yml rename to .github/workflows/release-stable-PRs.yml index 736fc088e..cc0a5ecec 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release-stable-PRs.yml @@ -1,5 +1,5 @@ # This Workflow performs a full release of chectl -name: Release chectl +name: Release on: workflow_dispatch: inputs: @@ -9,7 +9,7 @@ on: default: '7.y.z' jobs: build: - name: Create Release + name: Create stable release Pull Request runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml new file mode 100644 index 000000000..b6bab6c70 --- /dev/null +++ b/.github/workflows/unit-tests.yml @@ -0,0 +1,28 @@ +# +# Copyright (c) 2012-2020 Red Hat, Inc. +# This program and the accompanying materials are made +# available under the terms of the Eclipse Public License 2.0 +# which is available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +# +# Contributors: +# Red Hat, Inc. - initial API and implementation +name: Chectl +on: [pull_request] +jobs: + build-and-deploy: + runs-on: ubuntu-20.04 + name: Unit Tests + steps: + - name: Checkout + uses: actions/checkout@v2.3.1 + with: + persist-credentials: false + - uses: actions/setup-node@v1 + with: + node-version: '12' + - name: Install chectl dependencies + run: yarn + - name: Run unit tests + run: yarn test diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index aa22efadb..000000000 --- a/.travis.yml +++ /dev/null @@ -1,62 +0,0 @@ -jobs: - include: - - os: osx -language: node_js -node_js: '10' -before_deploy: -- | - if ! [ "$BEFORE_DEPLOY_DONE" ]; then - export BEFORE_DEPLOY_DONE=1 - brew update - brew install p7zip - git config --local user.name "Mario Loriedo" - git config --local user.email "mario.loriedo@gmail.com" - export TRAVIS_TAG=${TRAVIS_TAG:-$(date +'%Y%m%d%H%M%S')} - export CHECTL_VERSION="UNKNOWN" - export GITHUB_RELEASE_NAME=$TRAVIS_TAG - if [ "$TRAVIS_BRANCH" = master ]; then - echo "Branch is master branch..." - CURRENT_DAY=$(date +'%Y%m%d') - SHORT_SHA1=$(git rev-parse --short HEAD) - export CHECTL_VERSION=0.0.$CURRENT_DAY-next - export GITHUB_RELEASE_NAME=0.0.$CURRENT_DAY-next.$SHORT_SHA1 - fi; - if [ "$TRAVIS_BRANCH" = release ]; then - echo "Branch is release branch..." - export CHECTL_VERSION=$(cat VERSION) - export TRAVIS_TAG=${TRAVIS_TAG:-$CHECTL_VERSION} - export GITHUB_RELEASE_NAME=$CHECTL_VERSION - fi; - sed -i sed "s#version\":\ \"\(.*\)\",#version\":\ \"$CHECTL_VERSION\",#g" package.json - git tag $TRAVIS_TAG - TARGETS=linux-arm,linux-x64,linux-s390x,linux-ppc64le,darwin-x64,win32-x64,win32-x86 - npx oclif-dev pack --targets=$TARGETS - git clone https://github.com/che-incubator/chectl -b gh-pages --single-branch gh-pages - rm -rf gh-pages/.git - echo $(date +%s) > gh-pages/update - env - fi -deploy: - - provider: releases - api-key: - secure: eTiUIxetw+W54y7TIb3qttWPn0WFjotRamkzuILhzkWJOS21XpHJQNd/xi+fiS0q0bYaVBlnGR/z1xrJNPwjvygG6OMu7eIiDS7oHEXeH9i3WexmYlXesvuxVDVPieKMqfsctCNPP5dZim4aesRQ69kl64NE7ODLpu1DFdPwupjZOFl9VdjP0JdvdAWBrvRE/xe/bfJPfZb0DaLjXN6Cuf4Fh/r27U9avMFFFYMSkNInw2zqSos5yjDIgsTVd2ZEPrp7x0DWfQBmPrY7y7grRevLsZQI+J0e0yDpookb4VyGtI6dj53B3aO+PZ9nu852HWxrYHoYauzvdQOzsHqf/Q48a8yWHoBpcsA3iv4co264iETHBzfZDpuctatfX3xfKub3bD89cgt000vNhb/ynBvEtTsQkyccE5ZRJq9q53zemvdjNuVZeqrNyqWdgUYhOnNzAk69Nsv2dlPoY9kfCV63TC8r3Emq7PsTRF72D9KheLuMhObNRyg7SUD1BDqsESslOYx8KU9ifcWKyTd5GTrMSggNHSH7uctKzd3avSbWpetBkfxkEujOhLTnPnQEnq/yUqIWl3cK0uL6kKukkEz2/ycRvb8b760GnOxC0OJBxKENt/FDGW3+ydSWmhiH9plEhV68EJVGExrj+HMy73NLE3QlsngwPqFCogHBlvc= - file_glob: true - name: $GITHUB_RELEASE_NAME - file: - - "./dist/channels/**/chectl-*.gz" - skip_cleanup: true - on: - repo: che-incubator/chectl - tags: false - all_branches: true - condition: $TRAVIS_BRANCH =~ ^(master|release)$ - - provider: pages - github-token: - secure: eTiUIxetw+W54y7TIb3qttWPn0WFjotRamkzuILhzkWJOS21XpHJQNd/xi+fiS0q0bYaVBlnGR/z1xrJNPwjvygG6OMu7eIiDS7oHEXeH9i3WexmYlXesvuxVDVPieKMqfsctCNPP5dZim4aesRQ69kl64NE7ODLpu1DFdPwupjZOFl9VdjP0JdvdAWBrvRE/xe/bfJPfZb0DaLjXN6Cuf4Fh/r27U9avMFFFYMSkNInw2zqSos5yjDIgsTVd2ZEPrp7x0DWfQBmPrY7y7grRevLsZQI+J0e0yDpookb4VyGtI6dj53B3aO+PZ9nu852HWxrYHoYauzvdQOzsHqf/Q48a8yWHoBpcsA3iv4co264iETHBzfZDpuctatfX3xfKub3bD89cgt000vNhb/ynBvEtTsQkyccE5ZRJq9q53zemvdjNuVZeqrNyqWdgUYhOnNzAk69Nsv2dlPoY9kfCV63TC8r3Emq7PsTRF72D9KheLuMhObNRyg7SUD1BDqsESslOYx8KU9ifcWKyTd5GTrMSggNHSH7uctKzd3avSbWpetBkfxkEujOhLTnPnQEnq/yUqIWl3cK0uL6kKukkEz2/ycRvb8b760GnOxC0OJBxKENt/FDGW3+ydSWmhiH9plEhV68EJVGExrj+HMy73NLE3QlsngwPqFCogHBlvc= - skip_cleanup: true - keep_history: true - local-dir: gh-pages - on: - repo: che-incubator/chectl - all_branches: true - condition: $TRAVIS_BRANCH =~ ^(master|release)$