fix: use native shell commands for Gitea Actions
Some checks failed
Build & Deploy Java API / build (push) Failing after 1s

This commit is contained in:
gitea-ci
2026-07-22 01:14:53 +08:00
parent 74a57f251e
commit 0fdbda6cad

View File

@@ -19,36 +19,22 @@ jobs:
rm -rf "$WORK"
mkdir -p "$WORK"
- name: Checkout code
uses: actions/checkout@v4
with:
path: ${{ env.APP_NAME }}
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Cache Maven packages
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Clone code
run: |
cd /root/.cache/${{ env.APP_NAME }}
git clone https://joe:${GITEA_TOKEN}@git.cjjhc.top/joe/${{ env.APP_NAME }}.git .
- name: Login to Harbor
run: docker login ${{ env.REGISTRY }} -u admin -p "${{ secrets.HARBOR_PASSWORD }}"
- name: Build with Maven
run: |
cd ${{ env.APP_NAME }}
cd /root/.cache/${{ env.APP_NAME }}
mvn clean package -DskipTests
- name: Build & push Docker image
run: |
cd ${{ env.APP_NAME }}
cd /root/.cache/${{ env.APP_NAME }}
SHORT=${GITHUB_SHA::8}
TAG="${{ env.REGISTRY }}/${{ env.APP_NAME }}:${SHORT}"
LATEST="${{ env.REGISTRY }}/${{ env.APP_NAME }}:latest"
@@ -60,17 +46,18 @@ jobs:
- name: Update image tag in values.yaml (commit-back GitOps)
run: |
cd ${{ env.APP_NAME }}
SHORT=${GITHUB_SHA::8}
WORK=/root/.cache/${{ env.APP_NAME }}
rm -rf "$WORK"
mkdir -p "$WORK"
cd "$WORK"
git clone https://joe:${GITEA_TOKEN}@git.cjjhc.top/joe/${{ env.APP_NAME }}.git .
# Update tag in values.yaml
SHORT=${GITHUB_SHA::8}
sed -i "s/^ tag:.*/ tag: \"${SHORT}\"/" deploy/helm/values.yaml
# Configure git
git config user.email "ci@local"
git config user.name "gitea-ci"
# Commit and push
git add deploy/helm/values.yaml
git commit -m "ci: update image tag to ${SHORT}" || echo "nothing to commit"
git push origin main