diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..206fb9d --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,36 @@ +name: Build +# Run this workflow every time a new commit pushed to your repository +on: [pull_request] + +jobs: + # Set the job key. The key is displayed as the job name + # when a job name is not provided + build: + # Name the Job + name: build + # Set the type of machine to run on + runs-on: ubuntu-20.04 + + steps: + # Checks out a copy of your repository on the ubuntu-latest machine + - name: Checkout code + uses: actions/checkout@v2 + - name: Setup Go environment + uses: actions/setup-go@v2.1.3 + - name: build + run: GOBUILD="linux-amd64 windows-amd64 darwin-amd64" make -j build + - name: artifacts Linux + uses: actions/upload-artifact@v2 + with: + name: nomad-helper-linux-amd64 + path: build/nomad-helper-linux-amd64 + - name: artifacts MacOS + uses: actions/upload-artifact@v2 + with: + name: nomad-helper-darwin-amd64 + path: build/nomad-helper-darwin-amd64 + - name: artifacts Windows + uses: actions/upload-artifact@v2 + with: + name: nomad-helper-windows-amd64 + path: build/nomad-helper-windows-amd64 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..0210566 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,48 @@ +on: + release: + types: + - created + +name: Upload Release Assets + +jobs: + build: + name: Upload Release Asset + runs-on: ubuntu-20.04 + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Setup Go environment + uses: actions/setup-go@v2.1.3 + - name: build + run: GOBUILD="linux-amd64 windows-amd64 darwin-amd64" make -j build + - name: Upload linux binary + id: upload-release-asset-linux + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: ./build/nomad-helper-linux-amd64 + asset_name: nomad-helper-linux-amd64 + asset_content_type: application/octet-stream + - name: Upload MacOS binary + id: upload-release-asset-macos + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: ./build/nomad-helper-darwin-amd64 + asset_name: nomad-helper-darwin-amd64 + asset_content_type: application/octet-stream + - name: Upload Windows binary + id: upload-release-asset-windows + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: ./build/nomad-helper-windows-amd64 + asset_name: nomad-helper-windows-amd64 + asset_content_type: application/octet-stream diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index e222689..0000000 --- a/.travis.yml +++ /dev/null @@ -1,46 +0,0 @@ -sudo: required - -language: go - -go: - - 1.15.6 - -services: - - docker - -cache: - directories: - - $HOME/.cache/go-build - - $HOME/gopath/pkg/mod - -env: - global: - - CGO_ENABLED=0 - - GO111MODULE=on - - GOPROXY=https://proxy.golang.org - - GOBUILD="linux-amd64 windows-amd64 darwin-amd64" - -script: - - make -j build - - ls -la build - -after_success: - - export PR=https://api.github.com/repos/$TRAVIS_REPO_SLUG/pulls/$TRAVIS_PULL_REQUEST - - export BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo `curl -s $PR | jq -r .head.ref`; fi) - - echo "$DOCKER_PASSWORD" | docker login --username "$DOCKER_USERNAME" --password-stdin - - if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then make -j docker TAG=pr-$TRAVIS_PULL_REQUEST COMMIT=$TRAVIS_COMMIT; fi - - if [[ "$TRAVIS_TAG" =~ ^v.*$ ]]; then make -j docker TAG=$TRAVIS_TAG COMMIT=$TRAVIS_COMMIT; fi - - if [[ "$BRANCH" == "master" ]]; then make -j docker TAG=latest COMMIT=$TRAVIS_COMMIT; fi - -deploy: - provider: releases - api_key: "${GITHUB_TOKEN}" - file: - - build/nomad-helper-linux-amd64 - - build/nomad-helper-windows-amd64 - - build/nomad-helper-darwin-amd64 - skip_cleanup: true - overwrite: true - on: - tags: true - repo: seatgeek/nomad-helper diff --git a/Dockerfile b/Dockerfile index 87af1ed..6194530 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:3.8 +FROM alpine # Adding ca-certificates for external communication, and openssh # for attaching to remote nodes