Update dependencies (#25) #62
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Push (tag) | |
on: | |
push: | |
tags: | |
- '*' | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
go_version: [ '1.22' ] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go_version }} | |
- name: Run tests | |
shell: script -q -e -c "bash {0}" | |
run: go test -v -count=1 -cover ./... | |
docker-build: | |
runs-on: ubuntu-latest | |
needs: test | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: azure/docker-login@v1 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Set up docker buildx | |
id: buildx | |
uses: crazy-max/ghaction-docker-buildx@v1 | |
with: | |
buildx-version: latest | |
qemu-version: latest | |
- name: Docker buildx available platforms | |
run: echo ${{ steps.buildx.outputs.platforms }} | |
- name: Get the version | |
id: get_version | |
run: echo ::set-output name=TAG_NAME::${GITHUB_REF/refs\/tags\//} | |
- name: Run docker buildx build | |
run: | | |
docker buildx build \ | |
--platform linux/amd64 \ | |
--output=type=registry \ | |
--tag etf1/kafka-mongo-watcher:${{ steps.get_version.outputs.TAG_NAME }} \ | |
. | |
release: | |
runs-on: ubuntu-latest | |
needs: test | |
steps: | |
- name: Create release | |
id: create | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: ${{ github.ref }} | |
draft: false | |
prerelease: false | |
outputs: | |
upload_url: ${{ steps.create.outputs.upload_url }} | |
upload-binaries: | |
needs: release | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
goos: linux | |
goarch: amd64 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-go@v2 | |
with: | |
go-version: 1.17 | |
- name: Get the version | |
id: get_version | |
run: echo ::set-output name=TAG_NAME::${GITHUB_REF/refs\/tags\//} | |
- name: Build | |
run: GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -ldflags "-s -w -X github.com/etf1/kafka-mongo-watcher/config.AppVersion=${{ steps.get_version.outputs.TAG_NAME }}" -o kafka-mongo-watcher-${{ matrix.goos }}-${{ matrix.goarch }} ./cmd/watcher/ | |
- name: Upload release assets | |
id: upload-release-asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.release.outputs.upload_url }} | |
asset_path: ./kafka-mongo-watcher-${{ matrix.goos }}-${{ matrix.goarch }} | |
asset_name: kafka-mongo-watcher-${{ matrix.goos }}-${{ matrix.goarch }} | |
asset_content_type: application/octet-stream |