Docs: Update docker-compose.yml
examples
#149
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: ci | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- '**' | |
pull_request: | |
branches: | |
- master | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
.go/.cache | |
.go/pkg | |
key: ${{ runner.os }}-go-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Build binaries | |
run: | | |
make all-build | |
make checksums | |
- name: Tar binaries | |
run: | | |
tar -cvf binaries.tar .go/bin | |
- name: Upload binaries | |
uses: actions/upload-artifact@v3 | |
with: | |
name: binaries-${{ github.sha }} | |
path: | | |
binaries.tar | |
test: | |
runs-on: ubuntu-latest | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
.go/.cache | |
.go/pkg | |
key: ${{ runner.os }}-go-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Code Coverage | |
run: | | |
make test | |
bash <(curl -s https://codecov.io/bash) | |
docker: | |
needs: [build, test] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
# Ensure the same binaries are used from the build job | |
- name: Download binaries | |
uses: actions/download-artifact@v3 | |
with: | |
name: binaries-${{ github.sha }} | |
- name: Untar binaries | |
run: | | |
tar -xvf binaries.tar | |
- name: Login to docker registry | |
if: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') }} | |
env: | |
DOCKERHUB_REGISTRY_USER: ${{ secrets.DOCKERHUB_REGISTRY_USER }} | |
DOCKERHUB_REGISTRY_PASSWORD: ${{ secrets.DOCKERHUB_REGISTRY_PASSWORD }} | |
run: echo "${DOCKERHUB_REGISTRY_PASSWORD}" | docker login -u "${DOCKERHUB_REGISTRY_USER}" --password-stdin | |
- name: Build and push image | |
env: | |
DOCKERHUB_REGISTRY_USER: ${{ secrets.DOCKERHUB_REGISTRY_USER }} | |
run: | | |
make buildx-image "REGISTRY_USER=$DOCKERHUB_REGISTRY_USER" "BUILDX_TAG_LATEST=${{ startsWith(github.ref, 'refs/tags/') }}" "BUILDX_PUSH=${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') }}" | |
update-draft-release: | |
needs: [build,test,docker] | |
if: github.ref == 'refs/heads/master' | |
runs-on: ubuntu-latest | |
steps: | |
# Drafts your next Release notes as Pull Requests are merged into "master" | |
- id: release-drafter | |
uses: release-drafter/release-drafter@v5 | |
with: | |
config-name: release-drafter.yml | |
publish: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
release: | |
needs: [build,test,docker] | |
if: startsWith(github.ref, 'refs/tags/') | |
runs-on: ubuntu-latest | |
steps: | |
# Drafts your next Release notes as Pull Requests are merged into "master" | |
- id: release-drafter | |
uses: release-drafter/release-drafter@v5 | |
with: | |
config-name: release-drafter.yml | |
publish: false | |
name: ${{ github.ref_name }} | |
tag: ${{ github.ref_name }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# Ensure the same binaries are used from the build job | |
- name: Download binaries | |
uses: actions/download-artifact@v3 | |
with: | |
name: binaries-${{ github.sha }} | |
- name: Untar binaries | |
run: | | |
tar -xvf binaries.tar | |
# Upload binaries and publish | |
- uses: softprops/action-gh-release@v1 | |
with: | |
draft: false | |
name: ${{ steps.release-drafter.outputs.name }} | |
tag_name: ${{ steps.release-drafter.outputs.tag_name }} | |
body: ${{ steps.release-drafter.outputs.body }} | |
files: | | |
.go/bin/* | |
update-dockerhub-description: | |
if: github.ref == 'refs/heads/master' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Docker Hub Description | |
uses: peter-evans/dockerhub-description@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_REGISTRY_USER }} | |
password: ${{ secrets.DOCKERHUB_REGISTRY_PASSWORD }} | |
repository: ${{ github.repository }} | |
short-description: ${{ github.event.repository.description }} |