Skip to content

Bump docker/build-push-action from 5 to 6 (#105) #21

Bump docker/build-push-action from 5 to 6 (#105)

Bump docker/build-push-action from 5 to 6 (#105) #21

Workflow file for this run

name: Go
on:
push:
branches: [ "main" ]
tags:
- '*'
pull_request:
branches: [ "main" ]
env:
CGO_ENABLED: 0
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@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.19
- name: Test
run: |
go mod download
go test -cover -vet all
- name: Build
run: |
go build -a -ldflags "-X main.version=${GITHUB_REF_NAME} -X main.rev=${GITHUB_SHA}"
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: nytimes/drone-gae
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@v3
if: ${{ github.event_name != 'pull_request' }}
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# dry run, don't push image for pull_request event.
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Slack notification
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 posting on #dv-notifications for now.
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}