diff --git a/.github/workflows/go.yml b/.github/workflows/master.yml similarity index 88% rename from .github/workflows/go.yml rename to .github/workflows/master.yml index bae49bc..e6d6153 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/master.yml @@ -4,8 +4,6 @@ on: push: branches: - master - tags: - - v* pull_request: branches: - master @@ -20,7 +18,7 @@ jobs: - name: Set up Go 1.x uses: actions/setup-go@v2 with: - go-version: ^1.13 + go-version: ^1.15 id: go - name: Check out code into the Go module directory @@ -44,8 +42,8 @@ jobs: - name: Build and push Docker images uses: docker/build-push-action@v1.1.0 with: - username: imcitius + username: ${{ secrets.REGISTRY_LOGIN }} password: ${{ secrets.REGISTRY_PASSWORD }} - repository: imcitius/checker + repository: ${{ secrets.REGISTRY_LOGIN }} /checker tag_with_ref: true tag_with_sha: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..7923b2d --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,56 @@ +name: Go + +on: + push: + tags: + - v* + +jobs: + + build: + name: Build + runs-on: ubuntu-latest + steps: + + - name: Set up Go 1.x + uses: actions/setup-go@v2 + with: + go-version: ^1.15 + id: go + + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + + - name: Get dependencies + run: | + go get -v -t -d ./... + + - name: Build + run: go build -v -i -ldflags "-X my/checker/config.Version=${GITHUB_REF} -X my/checker/config.VersionSHA=${GITHUB_SHA} -X my/checker/config.VersionBuild=${GITHUB_RUN_ID}" -o build/${BINARY_NAME} + env: + BINARY_NAME: "checker" + + - name: Upload a Build Artifact + uses: actions/upload-artifact@v2 + with: + name: checker + path: build/checker + + - name: Build and push Docker images + uses: docker/build-push-action@v1.1.0 + with: + username: ${{ secrets.REGISTRY_LOGIN }} + password: ${{ secrets.REGISTRY_PASSWORD }} + repository: ${{ secrets.REGISTRY_LOGIN }} /checker + tag_with_ref: true + tag_with_sha: true + + - name: Upload binaries to release + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: build/checker + asset_name: checker + tag: ${{ github.ref }} + overwrite: true + body: "Checker release ${GITHUB_REF}" \ No newline at end of file