Skip to content

Commit 7538527

Browse files
committed
Add GitHub docker workflow
1 parent 01e5e4c commit 7538527

2 files changed

Lines changed: 41 additions & 0 deletions

File tree

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: satterly

.github/workflows/docker.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Docker Build and Push
2+
3+
on:
4+
push:
5+
branches: [ master, release/* ]
6+
7+
env:
8+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
env:
14+
REPOSITORY_URL: docker.pkg.github.com
15+
IMAGE_NAME: ${{ github.repository }}/alerta-cli
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v2
19+
- name: Variables
20+
id: vars
21+
run: echo "::set-output name=SHORT_COMMIT_ID::$(git rev-parse --short HEAD)"
22+
- name: Build image
23+
run: >-
24+
docker build
25+
-t $IMAGE_NAME
26+
-t $REPOSITORY_URL/$IMAGE_NAME:${{ steps.vars.outputs.SHORT_COMMIT_ID }}
27+
-t $REPOSITORY_URL/$IMAGE_NAME:latest .
28+
- name: Docker Login
29+
env:
30+
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
31+
DOCKER_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
32+
run: docker login $REPOSITORY_URL --username "$DOCKER_USERNAME" --password "$DOCKER_PASSWORD"
33+
- name: Publish Image
34+
run: docker push $REPOSITORY_URL/$IMAGE_NAME
35+
36+
- name: Notify Slack
37+
uses: alerta/actions/slacky@master
38+
with:
39+
status: ${{ job.status }}
40+
if: always()

0 commit comments

Comments
 (0)