diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..ad38eed --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,55 @@ +name: CI +jobs: + # ================ + # TEST JOB + # ================ + test: + name: Test + runs-on: ubuntu-latest + runs-on: ${{ matrix.platform }} + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: '1.18' + check-latest: true + cache: true + - name: Checkout code + uses: actions/checkout@v2 + - name: Build + run: go build -v . + - name: Test + run: go test -v ./... + # ================ + # RELEASE JOB + # runs after a success test + # only runs on push "v*" tag + # ================ + release: + name: Release + needs: test + if: startsWith(github.ref, 'refs/tags/v') + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: '1.18' + check-latest: true + cache: true + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v3 + with: + distribution: goreleaser + version: latest + args: release --rm-dist --config .github/goreleaser.yml + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 0b37f86..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,30 +0,0 @@ -on: - push: - tags: - - "v*" - workflow_dispatch: - inputs: -name: CI -jobs: - Release: - name: Release - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: Install Go - uses: actions/setup-go@v3 - with: - go-version: '1.18' - check-latest: true - cache: true - - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v3 - with: - distribution: goreleaser - version: latest - args: release --rm-dist --config .github/goreleaser.yml - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 1836935..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,24 +0,0 @@ -on: [push, pull_request] -name: Test -jobs: - Build: - strategy: - matrix: - go-version: [1.18.x] - platform: [ubuntu-latest, macos-latest, windows-latest] - runs-on: ${{ matrix.platform }} - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: Install Go - uses: actions/setup-go@v3 - with: - go-version: '1.18' - check-latest: true - cache: true - - name: Build - run: go build -v -o /tmp/installer - - name: Test - run: go test -v ./... \ No newline at end of file