🔧 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:
|
||||
image: node:20-alpine
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Manual Git Checkout
|
||||
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
|
||||
run: npm ci
|
||||
|
|
@ -28,18 +33,25 @@ jobs:
|
|||
needs: lint
|
||||
runs-on: self-hosted
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Manual Git Checkout
|
||||
run: |
|
||||
apt-get update
|
||||
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
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y curl
|
||||
curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
|
||||
apt-get install -y nodejs
|
||||
|
||||
- name: Install Sonar Scanner (npm)
|
||||
run: npm install -g sonarqube-scanner
|
||||
|
||||
- name: SonarQube Scan
|
||||
env:
|
||||
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
|
||||
|
|
@ -83,12 +95,16 @@ jobs:
|
|||
needs: [lint, sonar]
|
||||
runs-on: self-hosted
|
||||
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
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Login to registry
|
||||
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