-
Notifications
You must be signed in to change notification settings - Fork 3
88 lines (86 loc) · 3.34 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
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
85
86
87
88
name: CI
on:
push: {}
pull_request: {}
release:
types:
- published
jobs:
prepare:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
# we block concurrent executions because of concurrency issues
# on docker build image
- name: 'Block Concurrent Executions'
uses: softprops/turnstyle@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v4
name: checkout repository
# only for push or release
- name: make docker buildimage
uses: elgohr/Publish-Docker-Github-Action@v5
if: startsWith(github.ref, 'refs/tags/v') || github.event_name == 'push'
with:
username: "${{ secrets.DOCKER_USERNAME }}"
password: "${{ secrets.DOCKER_PASSWORD }}"
name: metwork/logproxy-centos6-buildimage
workdir: docker
cache: true
tags: "temporary"
build:
runs-on: ubuntu-latest
needs: prepare
steps:
- name: checkout repository
uses: actions/checkout@v4
- name: debug env
run: env |grep GITHUB
- name: compute tag name
id: vars
run: |
TMPREF=${GITHUB_REF#refs/*/}
if [[ "$TMPREF" == */merge ]]; then echo "tag="`echo pr${TMPREF} |awk -F '/' '{print $1;}'`>> ${GITHUB_OUTPUT}; else echo "tag="${TMPREF} >> ${GITHUB_OUTPUT}; fi
#if [[ "$TMPREF" == */merge ]]; then echo ::set-output name=tag::`echo pr${TMPREF} |awk -F '/' '{print $1;}'`; else echo ::set-output name=tag::${TMPREF}; fi
- name: "Install system deps"
run: |
sudo apt-get update
sudo apt-get -y install valgrind
- name: "Basic build and test"
run: |
make DEBUG=yes
make leak
make clean
make
# only for releases or push
- name: release
uses: docker://metwork/logproxy-centos6-buildimage:temporary
if: startsWith(github.ref, 'refs/tags/v') || github.event_name == 'push'
# only for releases or push
- name: make tar.gz
if: startsWith(github.ref, 'refs/tags/v') || github.event_name == 'push'
run: |
mkdir log_proxy-linux64-${{ steps.vars.outputs.tag }}
cp release/usr/local/bin/* log_proxy-linux64-${{ steps.vars.outputs.tag }}/
tar -cvf log_proxy-linux64-${{ steps.vars.outputs.tag }}.tar log_proxy-linux64-${{ steps.vars.outputs.tag }}
gzip log_proxy-linux64-${{ steps.vars.outputs.tag }}.tar
# only for releases or push
- name: upload artifact
if: startsWith(github.ref, 'refs/tags/v') || github.event_name == 'push'
uses: actions/upload-artifact@v1
with:
name: log_proxy-linux64-${{ steps.vars.outputs.tag }}
path: ./log_proxy-linux64-${{ steps.vars.outputs.tag }}
# only for releases
- name: upload release asset
id: upload-release-asset
if: startsWith(github.ref, 'refs/tags/v') && github.event_name == 'release'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./log_proxy-linux64-${{ steps.vars.outputs.tag }}.tar.gz
asset_name: log_proxy-linux64-${{ steps.vars.outputs.tag }}.tar.gz
asset_content_type: application/gzip