diff options
Diffstat (limited to '.github')
-rw-r--r-- | .github/workflows/docker.yml | 51 | ||||
-rw-r--r-- | .github/workflows/go.yml | 14 |
2 files changed, 65 insertions, 0 deletions
diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..11e938e --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,51 @@ +name: Publish Docker Image + +on: + # Runs when a new release is tagged. + release: + types: [published] + + # Or when we manually run it from the UI. + workflow_dispatch: + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + build-and-push-image: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + # This action inspects the GitHub event metadata + # and fills tags and labels (e.g. 'latest') + # needed for the build step. + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + - name: Log into Container Registry + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Build and push image + uses: docker/build-push-action@v4 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 7411a85..7561b25 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -31,3 +31,17 @@ jobs: - name: Upload coverage to codecov.io uses: codecov/codecov-action@v1 + + docker: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Build image + uses: docker/build-push-action@v4 + with: + context: . |