Skip to content

Merge pull request #14 from nytimes/121 #9

Merge pull request #14 from nytimes/121

Merge pull request #14 from nytimes/121 #9

Workflow file for this run

name: Build and Push Docker Image
on:
push:
branches: [ "main" ]
tags:
- '*'
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
permissions:
actions: write
checks: write
contents: write
deployments: write
id-token: write
issues: write
pull-requests: write
security-events: write
statuses: write
steps:
- uses: actions/checkout@v3
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: nytimes/golang-gcloud-sdk
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# commenting out until we get the webhook secret
#- name: Send GitHub Action trigger data to Slack workflow
# id: slack
# uses: slackapi/[email protected]
# if: ${{ github.event_name != 'pull_request' }}
# with:
# payload: |
# {
# "text": "GitHub Actions Build Result: ${{ job.status }}\n triggered_by: ${{ github.actor }}\n job url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}\n commit url: ${{ github.event.head_commit.url }}"
# }
# env:
# # webhook for #dv-cdp-alerts
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}