-
Notifications
You must be signed in to change notification settings - Fork 7
59 lines (57 loc) · 1.8 KB
/
build.yml
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
name: TACC Docs Build
on:
workflow_dispatch:
push:
branches:
- main
jobs:
docker:
runs-on: ubuntu-latest
steps:
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Checkout repo
uses: actions/checkout@v3
-
name: Get shortsha and branch name
id: vars
run: |
if [ -z "$EVENT_SHA" ]; then SHORT_SHA=${GITHUB_SHA::8}; else SHORT_SHA=${EVENT_SHA::8}; fi
echo ::set-output name=sha_short::${SHORT_SHA}
BRANCH_SHORT=`git symbolic-ref --short HEAD | sed 's/[^[:alnum:]\.\_\-]/-/g'`
echo ::set-output name=branch_short::${BRANCH_SHORT}
env:
EVENT_SHA: ${{ github.event.client_payload.sha }}
- name: Print vars
run: |
echo $SHORTSHA
echo $BRANCH_SHORT
env:
SHORTSHA: ${{ steps.vars.outputs.sha_short }}
BRANCH_SHORT: ${{ steps.vars.outputs.branch_short }}
-
name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
uses: docker/build-push-action@v3
with:
push: true
tags: taccwma/tacc-docs:latest,taccwma/tacc-docs:${{ steps.vars.outputs.sha_short }},taccwma/tacc-docs:${{ steps.vars.outputs.branch_short }}
-
name: Post build status in slack
id: slack
uses: slackapi/slack-github-action@v1.23.0
with:
# This data can be any valid JSON from a previous step in the GitHub Action
payload: |
{
"build_status": "${{ job.status }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}