-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (60 loc) · 1.81 KB
/
ci-build-ref.yaml
File metadata and controls
61 lines (60 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
on:
workflow_call:
inputs:
image:
required: true
type: string
ref:
required: true
type: string
name:
required: true
type: string
file:
required: false
type: string
default: "Dockerfile"
secrets:
REGISTRY_SECRET:
required: true
SLACK_CHANNEL:
required: true
SLACK_TOKEN:
required: true
NPM_TOKEN:
required: false
jobs:
build_image:
name: Image
runs-on: ubuntu-latest
steps:
- run: echo "Building ${{ inputs.ref }}"
- name: Login to the Registry
uses: docker/login-action@v1
with:
registry: gcr.io
username: _json_key
password: ${{ secrets.REGISTRY_SECRET }}
- name: Build and Push image
uses: docker/build-push-action@v2
with:
tags: ${{ inputs.image }}:${{ inputs.ref }}
file: ${{ inputs.file }}
push: true
build-args: |
NPM_TOKEN=${{ secrets.NPM_TOKEN }}
VERSION=${{ inputs.ref }}
- name: Notify Slack
if: ${{ success() }}
uses: docker://automationcloud/rsslack:latest
with:
channel: ${{ secrets.slack_channel }}
slack_token: ${{ secrets.SLACK_TOKEN }}
message: ":package: *${{ inputs.name }}* has been built and pushed to `${{ inputs.image }}:${{ inputs.ref }}`"
- name: Notify Slack on Failure
if: ${{ failure() }}
uses: docker://automationcloud/rsslack:latest
with:
channel: ${{ secrets.SLACK_CHANNEL }}
slack_token: ${{ secrets.SLACK_TOKEN }}
message: ":suspicious: *${{ inputs.name }}* build failed - Run <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.run_id }}>"