-
-
Notifications
You must be signed in to change notification settings - Fork 7
76 lines (59 loc) · 2.26 KB
/
linux.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
name: 'Linux'
env:
DEPLOY_MESSAGE:
"Push artifact from GitHub Actions build ${{ github.run_number }} with id ${{ github.run_id }}
- ncline artifact from branch 'BRANCH_NAME' with commit id ${{ github.sha }}"
DEPLOY_BRANCH: ncline-BRANCH_NAME-OS-COMPILER
on: [push, workflow_dispatch]
jobs:
Linux:
strategy:
fail-fast: false
matrix:
include:
- CC: gcc
CXX: g++
- CC: clang
CXX: clang++
runs-on: 'ubuntu-22.04'
steps:
- name: 'Checkout Code'
uses: actions/checkout@v4
- name: 'Unshallow Git Repository for Versioning'
run: |
git fetch --unshallow || true
- name: 'CMake Configuration'
run: |
export CC=${{ matrix.CC }}
export CXX=${{ matrix.CXX }}
cmake -B ../ncline-build-Release -D CMAKE_BUILD_TYPE=Release
- name: 'Make'
run: |
make -j2 -C ../ncline-build-Release
- name: 'Package'
run: |
make package -C ../ncline-build-Release
- name: 'Push Artifacts'
env:
PUBLIC_REPO_TOKEN: ${{ secrets.PUBLIC_REPO_TOKEN }}
run: |
git config --global user.email "actions@github.com"
git config --global user.name "GitHub Actions"
export BRANCH_NAME=$(git describe --tags --exact-match 2> /dev/null || git symbolic-ref -q --short HEAD || git rev-parse --short HEAD)
export DEPLOY_MESSAGE=`sed 's/BRANCH_NAME/'"$BRANCH_NAME"'/' <<< "$DEPLOY_MESSAGE"`
export OS=linux
export CC=${{ matrix.CC }}
cd ..
export DEPLOY_BRANCH=`echo $DEPLOY_BRANCH | sed 's/BRANCH_NAME/'"$BRANCH_NAME"'/'`
export DEPLOY_BRANCH=`echo $DEPLOY_BRANCH | sed 's/OS/'"$OS"'/'`
export DEPLOY_BRANCH=`echo $DEPLOY_BRANCH | sed 's/COMPILER/'"$CC"'/'`
git clone https://$PUBLIC_REPO_TOKEN@github.com/$GITHUB_REPOSITORY-artifacts.git >/dev/null 2>&1
cd ncline-artifacts
git checkout $DEPLOY_BRANCH || git checkout --orphan $DEPLOY_BRANCH
git reset
git clean -f
git rm * || true
mv -f ../ncline-build-Release/*.tar.gz .
git add *.tar.gz
git commit --amend -m "$DEPLOY_MESSAGE" || git commit -m "$DEPLOY_MESSAGE"
git push --force || git push --set-upstream origin $DEPLOY_BRANCH