This repository has been archived by the owner on Aug 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 28
84 lines (74 loc) · 2.56 KB
/
dockerhub-pr-with-parameters.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: DockerHub (PR) with parameters
on:
issue_comment:
types: [created]
jobs:
check_comments:
name: Check comments for /deploy
runs-on: ubuntu-latest
steps:
- name: Check for Command
id: command
uses: xt0rted/slash-command-action@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
command: deploy
reaction: "true"
reaction-type: "eyes"
allow-edits: "false"
permission-level: write
- uses: jungwinter/split@v2
id: split
with:
msg: '${{ steps.command.outputs.command-arguments }}'
maxsplit: 1
- uses: xt0rted/pull-request-comment-branch@v1
id: comment-branch
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v3
if: success()
with:
ref: ${{ steps.comment-branch.outputs.head_ref }}
- name: Find and Replace
uses: jacobtomlinson/gha-find-replace@master
with:
find: "newTag: development"
replace: "newTag: ${{ steps.comment-branch.outputs.head_ref }}"
include: "kustomization.yaml"
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: build-tag-push
uses: docker/build-push-action@v3
id: docker
with:
context: .
file: docker/Dockerfile
tags: xaynetwork/xaynet:${{ steps.comment-branch.outputs.head_ref }}
push: true
build-args: |
${{ steps.split.outputs._0 }}
${{ steps.split.outputs._1 }}
- name: Notify on Slack
uses: 8398a7/action-slack@v3
if: ${{ success() }}
with:
status: custom
fields: workflow,job,repo,ref
custom_payload: |
{
username: 'GitHub Actions',
icon_emoji: ':octocat:',
attachments: [{
color: '${{ steps.docker.outcome }}' === 'success' ? 'good' : '${{ steps.docker.outcome }}' === 'failure' ? 'danger' : 'warning',
text: `${process.env.AS_WORKFLOW}\nRepository: :xaynet: ${process.env.AS_REPO}\nRef: ${process.env.AS_REF}\nTags: ${{ steps.comment-branch.outputs.head_ref }}`,
}]
}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}