auto-staging/stagectl

View on GitHub
.travis.yml

Summary

Maintainability
Test Coverage
stages:
  - test

  - name: release
    if: branch = master AND type != pull_request

  - name: build
    if: branch = master AND type != pull_request

jobs:
  include:
    - stage: test
      language: go
      go: 'stable'
      before_script:
        # Setup dependency management tool (go dep)
        - curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
        - chmod +x $GOPATH/bin/dep
      script:
        - make prepare
        - make tests
    
    - stage: release
      language: node_js
      install:
        - . $HOME/.nvm/nvm.sh
        - nvm install stable
        - nvm use stable
        - npm install @semantic-release/changelog && npm install @semantic-release/git && npm install atob-lite
      script:
        - npx semantic-release
    
    - stage: build
      language: go
      go: 'stable'
      before_script:
        # Setup dependency management tool (go dep)
        - curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
        - chmod +x $GOPATH/bin/dep
        # Install Python 3
        - sudo apt-get install python3 python3-pip -y
        # Use latest master version, which includes the git tag from the release step
        - git checkout master
      script:
        - go get github.com/mitchellh/gox
        - go get github.com/tcnksm/ghr
        - make prepare
        - NOW=$(date +'%Y-%m-%d_%T')
        - gox -output "dist/{{.OS}}_{{.Arch}}_{{.Dir}}" -ldflags "-X github.com/auto-staging/stagectl/cmd.gitSha=`git rev-parse HEAD` -X github.com/auto-staging/stagectl/cmd.buildTime=$NOW -X github.com/auto-staging/stagectl/cmd.version=`git describe --abbrev=0 --tags`" -arch="amd64 386" -os="linux darwin windows"
        - ghr --username auto-staging --token $GITHUB_TOKEN --replace $(git describe --abbrev=0 --tags) dist/
        # Create new Homebrew formula
        - export FILE_HASH=`sha256sum dist/darwin_amd64_stagectl | awk '{print $1}'`
        - export VERSION=`git describe --abbrev=0 --tags`
        - git clone https://${GITHUB_TOKEN}@github.com/auto-staging/homebrew-stagectl.git
        - cd homebrew-stagectl
        - pip3 install --user jinja2
        - python3 generateFormula.py
        - 'git add stagectl.rb && git commit -m "chore: deployment of version $VERSION - $NOW" && git push'