build: update #241
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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@v4 | |
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 |