-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from nytimes/pr-build
create separate pull request actions workflow
- Loading branch information
Showing
2 changed files
with
57 additions
and
17 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,11 +2,10 @@ name: Build and Push Docker Image | |
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
branches: | ||
- main | ||
tags: | ||
- '*' | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
build: | ||
|
@@ -48,20 +47,18 @@ jobs: | |
with: | ||
context: . | ||
platforms: linux/amd64 | ||
push: ${{ github.event_name != 'pull_request' }} | ||
push: true | ||
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 }} | ||
- 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: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Test Docker Image Build | ||
|
||
on: | ||
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: Set Docker Metadata | ||
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: Build Image | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
platforms: linux/amd64 | ||
push: false | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |