From d19447537a4a6d614ff6aaf521c0c7fbc67bff6b Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Sun, 2 Aug 2020 13:39:11 +1000 Subject: [PATCH] add github actions --- .github/cd.yml | 28 ++++++++++++++++++++++++++++ .github/ci.yml | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 .github/cd.yml create mode 100644 .github/ci.yml diff --git a/.github/cd.yml b/.github/cd.yml new file mode 100644 index 0000000..50e38ac --- /dev/null +++ b/.github/cd.yml @@ -0,0 +1,28 @@ +name: Continuous Delivery + +on: + push: + tags: + - 'v*' + +jobs: + cd: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Unshallow repo + run: git fetch --prune --unshallow + - name: Setup Go + uses: actions/setup-go@v1 + with: + go-version: 1.14.x + - name: Run goreleaser + uses: goreleaser/goreleaser-action@v1 + env: + GITHUB_TOKEN: ${{secrets.GITHUB_API_TOKEN}} + - name: Bump Homebrew + uses: dawidd6/action-homebrew-bump-formula@v3 + with: + token: ${{secrets.GITHUB_API_TOKEN}} + formula: horcrux diff --git a/.github/ci.yml b/.github/ci.yml new file mode 100644 index 0000000..7147419 --- /dev/null +++ b/.github/ci.yml @@ -0,0 +1,41 @@ +name: Continuous Integration + +on: + push: + branches: + - '*' + pull_request: [] + +jobs: + ci: + runs-on: ubuntu-latest + env: + GOFLAGS: -mod=vendor + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Setup Go + uses: actions/setup-go@v1 + with: + go-version: 1.14.x + - name: Cache build + uses: actions/cache@v1 + with: + path: ~/.cache/go-build + key: ${{runner.os}}-go-${{hashFiles('**/go.sum')}} + restore-keys: | + ${{runner.os}}-go- + - name: Format code + run: | + if [ $(find . ! -path "./vendor/*" -name "*.go" -exec gofmt -s -d {} \;|wc -l) -gt 0 ]; then + find . ! -path "./vendor/*" -name "*.go" -exec gofmt -s -d {} \; + exit 1 + fi + # no tests for now + # - name: Test code + # run: | + # ./test.sh + - name: Build binaries + uses: goreleaser/goreleaser-action@v1 + with: + args: --skip-publish --snapshot