-
Notifications
You must be signed in to change notification settings - Fork 11
86 lines (82 loc) · 2.52 KB
/
tn.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
name: "Token Negotiator CI"
on:
push:
branches:
- main
- staging
- ci-testing
tags:
- "v*"
pull_request:
branches:
- "*"
workflow_dispatch:
jobs:
tn-p1:
uses: ./.github/workflows/tn-p1.yml
secrets: inherit
sonarcloud:
needs:
- tn-p1
name: SonarCloud
runs-on: ubuntu-latest
# dependabot created branch has a very long name, which will cause issue for SonarCloud
if: "!startsWith(github.head_ref, 'dependabot/')"
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- uses: actions/download-artifact@v3
with:
name: test-report
path: reports/
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
gh-pages:
needs:
- tn-p1
permissions:
pages: write
id-token: write
contents: write
runs-on: ubuntu-latest
if: github.event_name == 'push' && (contains(fromJson('["main", "ci-testing"]'), github.ref_name) || github.ref_type == 'tag' )
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: token-negotiator-dist
path: token-negotiator-dist/
- name: Deploy to GitHub Pages
id: deployment
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Action"
git config --global credential.helper store
echo "https://oauth2:${GITHUB_TOKEN}@github.com" > ~/.git-credentials
TARGET=latest
if [ x"${GITHUB_REF_TYPE}" = x"tag" ]; then
TARGET="${GITHUB_REF_NAME}"
fi
npx -y @koumoul/gh-pages-multi deploy -s token-negotiator-dist/ -t "${TARGET}" --no-history -v
- name: copy latest dir to root dir
run: |
git remote set-branches origin 'gh-pages'
git fetch origin gh-pages
git checkout .
git checkout gh-pages
rm -fr token-negotiator-dist
if [ -d "latest" ]; then
rm -fr theme negotiator*
cp -frv latest/. .
fi
git add .
if ! git diff --quiet HEAD; then
git commit -a --amend --no-edit
git push -f
fi