diff --git a/.github/workflows/publish-binaries.yml b/.github/workflows/publish-binaries.yml new file mode 100644 index 0000000..8170c60 --- /dev/null +++ b/.github/workflows/publish-binaries.yml @@ -0,0 +1,25 @@ +on: + release: + types: [created] + +jobs: + release: + name: Publish Go Binaries + runs-on: ubuntu-latest + strategy: + matrix: + # build and publish in parallel: linux/386, linux/amd64, windows/386, windows/amd64, darwin/amd64 + goos: [linux, windows, darwin] + goarch: ["386", amd64] + exclude: + - goarch: "386" + goos: darwin + steps: + - uses: actions/checkout@v2 + - uses: wangyoucao577/go-release-action@v1.20 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + goos: ${{ matrix.goos }} + goarch: ${{ matrix.goarch }} + goversion: "https://dl.google.com/go/go1.16.6.linux-amd64.tar.gz" + extra_files: LICENSE README.md diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8537fb5..e27a068 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,11 +1,11 @@ -name: Release on: push: branches: - main + jobs: release: - name: Release + name: Build and test runs-on: ubuntu-latest steps: - name: Checkout @@ -15,25 +15,20 @@ jobs: - name: Setup Go uses: actions/setup-go@v2 - name: Build - run: make build - - name: Commit and tag - uses: EndBug/add-and-commit@v7 # You can change this to use a specific version. + run: | + make build + - name: "Build Changelog" + id: build_changelog + uses: mikepenz/release-changelog-builder-action@v2 with: - add: "bin/cli" - author_name: Commit Bot - author_email: contact@usecloudstate.io - message: "Release v${{ github.run_number }}" - push: true - tag: "v${{ github.run_number }}" - - name: Publish Release - uses: "marvinpinto/action-automatic-releases@latest" + commitMode: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Create Release + uses: actions/create-release@v1 with: - repo_token: "${{ secrets.GITHUB_TOKEN }}" - automatic_release_tag: "v${{ github.run_number }}" - files: | - bin/cli - - name: Publish to homebrew tap - uses: izumin5210/action-homebrew-tap@latest - with: - tap: usecloudstate/homebrew-cli - token: ${{ secrets.GITHUB_TOKEN }} + tag_name: v${{ github.run_number }} + release_name: v${{ github.run_number }} + body: ${{steps.github_release.outputs.changelog}} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..a44d876 --- /dev/null +++ b/install.sh @@ -0,0 +1,74 @@ +#!/bin/bash +{ + set -e + SUDO='' + if [ "$(id -u)" != "0" ]; then + SUDO='sudo' + echo "This script requires superuser access." + echo "You will be prompted for your password by sudo." + # clear any previous sudo permission + sudo -k + fi + + + # run inside sudo + $SUDO bash <