🔧 chore(workflows): replace actions/checkout with manual git checkout
- implement manual git checkout steps in build workflow - remove actions/checkout usage to customize git operations
This commit is contained in:
parent
b9280ef8bf
commit
c8624e7ceb
1 changed files with 25 additions and 9 deletions
|
|
@ -15,8 +15,13 @@ jobs:
|
||||||
container:
|
container:
|
||||||
image: node:20-alpine
|
image: node:20-alpine
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Manual Git Checkout
|
||||||
uses: actions/checkout@v4
|
run: |
|
||||||
|
apk add --no-cache git
|
||||||
|
git init
|
||||||
|
git remote add origin ${{ github.server_url }}/${{ github.repository }}.git
|
||||||
|
git fetch --depth 1 origin ${{ github.ref }}
|
||||||
|
git checkout FETCH_HEAD
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
|
|
@ -28,18 +33,25 @@ jobs:
|
||||||
needs: lint
|
needs: lint
|
||||||
runs-on: self-hosted
|
runs-on: self-hosted
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Manual Git Checkout
|
||||||
uses: actions/checkout@v4
|
run: |
|
||||||
with:
|
apt-get update
|
||||||
fetch-depth: 0
|
apt-get install -y git
|
||||||
|
git init
|
||||||
|
git remote add origin ${{ github.server_url }}/${{ github.repository }}.git
|
||||||
|
git fetch --depth 1 origin ${{ github.ref }}
|
||||||
|
git checkout FETCH_HEAD
|
||||||
|
|
||||||
- name: Install Node.js
|
- name: Install Node.js
|
||||||
run: |
|
run: |
|
||||||
apt-get update
|
apt-get update
|
||||||
apt-get install -y curl
|
apt-get install -y curl
|
||||||
curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
|
curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
|
||||||
apt-get install -y nodejs
|
apt-get install -y nodejs
|
||||||
|
|
||||||
- name: Install Sonar Scanner (npm)
|
- name: Install Sonar Scanner (npm)
|
||||||
run: npm install -g sonarqube-scanner
|
run: npm install -g sonarqube-scanner
|
||||||
|
|
||||||
- name: SonarQube Scan
|
- name: SonarQube Scan
|
||||||
env:
|
env:
|
||||||
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
|
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
|
||||||
|
|
@ -83,12 +95,16 @@ jobs:
|
||||||
needs: [lint, sonar]
|
needs: [lint, sonar]
|
||||||
runs-on: self-hosted
|
runs-on: self-hosted
|
||||||
steps:
|
steps:
|
||||||
|
- name: Manual Git Checkout
|
||||||
|
run: |
|
||||||
|
git init
|
||||||
|
git remote add origin ${{ github.server_url }}/${{ github.repository }}.git
|
||||||
|
git fetch --depth 1 origin ${{ github.ref }}
|
||||||
|
git checkout FETCH_HEAD
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Login to registry
|
- name: Login to registry
|
||||||
run: echo "${{ secrets.REG_TOKEN }}" | docker login "${{ secrets.REGISTRY }}" -u "${{ secrets.REG_USER }}" --password-stdin
|
run: echo "${{ secrets.REG_TOKEN }}" | docker login "${{ secrets.REGISTRY }}" -u "${{ secrets.REG_USER }}" --password-stdin
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue