Merge pull request #862 from TokenScript/dependabot/npm_and_yarn/post… #1511
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: "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@v4 | |
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@v4 | |
- 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 "action@github.com" | |
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 |