forked from e-mission/em-public-dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (72 loc) · 2.61 KB
/
image_build_push.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
name: docker-image-push-public-dash
on:
push:
# branches: [ main, cleanup-cicd ]
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
workflow_dispatch:
jobs:
dump_contexts_to_log:
runs-on: ubuntu-latest
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Dump job context
env:
JOB_CONTEXT: ${{ toJson(job) }}
run: echo "$JOB_CONTEXT"
- name: Dump steps context
env:
STEPS_CONTEXT: ${{ toJson(steps) }}
run: echo "$STEPS_CONTEXT"
- name: Dump runner context
env:
RUNNER_CONTEXT: ${{ toJson(runner) }}
run: echo "$RUNNER_CONTEXT"
- name: Dump strategy context
env:
STRATEGY_CONTEXT: ${{ toJson(strategy) }}
run: echo "$STRATEGY_CONTEXT"
- name: Dump matrix context
env:
MATRIX_CONTEXT: ${{ toJson(matrix) }}
run: echo "$MATRIX_CONTEXT"
debug-info:
runs-on: ubuntu-latest
steps:
- name: Print commit info
run: |
echo "Commit message: ${{ github.event.head_commit.message }}"
echo "Head commit author: ${{ github.event.head_commit.author.name }}"
echo "Event name: ${{ github.event_name }}"
echo "Actor: ${{ github.actor }}"
echo "Ref: ${{ github.ref }}"
echo "Ref name: ${{ github.ref_name }}"
echo "Ref type: ${{ github.ref_type }}"
echo "Default branch: ${{ github.event.repository.default_branch }}"
echo "Github event base ref: ${{ github.event.base_ref }}"
get-branch-name:
runs-on: ubuntu-latest
outputs:
branch_name: ${{ steps.get-branch-name.outputs.branch_name }}
steps:
- name: Get branch name based on ref_type
id: get-branch-name
run: |
if [ "${{ github.ref_type }}" == "tag" ]; then
base_ref=${{ github.event.base_ref }}
echo "Branch name: branch_name=${base_ref#refs/heads/}"
echo "branch_name=${base_ref#refs/heads/}" >> "$GITHUB_OUTPUT"
elif [ "${{ github.ref_type }}" == "branch" ]; then
echo "branch_name=${GITHUB_REF##*/}" >> "$GITHUB_OUTPUT"
fi
build:
if: ${{ !contains(github.event.head_commit.author.name, 'Github Actions bot to update .env with latest tags') }}
needs: [get-branch-name]
uses: MukuFlash03/e-mission-server/.github/workflows/reusable_image_build_push.yml@cleanup-cicd
with:
repo: ${{ github.event.repository.name }}
branch: ${{ needs.get-branch-name.outputs.branch_name }}
secrets: inherit