ci: simplify workflow - use current directory (repo auto-checked-out)
Build and Push Memory Service / Build and Push Image (push) Failing after 9s
Build and Push Memory Service / Build and Push Image (push) Failing after 9s
Previous failure: git clone tried to clone into /workspace which already exists Fix: - Remove git clone step - Forgejo automatically checks out repo into current directory - Just install git, get commit info, build, and push - Much simpler and cleaner
This commit is contained in:
@@ -13,19 +13,15 @@ jobs:
|
|||||||
image: docker:27-dind
|
image: docker:27-dind
|
||||||
options: --privileged
|
options: --privileged
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Install git
|
||||||
run: |
|
run: |
|
||||||
apk add --no-cache git
|
apk add --no-cache git
|
||||||
git clone https://git.riotpiao.com:2222/rock/poimen-memory.git /workspace
|
|
||||||
cd /workspace
|
|
||||||
git checkout ${{ github.sha }}
|
|
||||||
|
|
||||||
- name: Get commit info
|
- name: Get commit info
|
||||||
id: info
|
id: info
|
||||||
run: |
|
run: |
|
||||||
cd /workspace
|
SHORT_SHA=$(git -C . rev-parse --short HEAD)
|
||||||
SHORT_SHA=$(git rev-parse --short HEAD)
|
COMMIT_MSG=$(git -C . log -1 --pretty=%B | head -1)
|
||||||
COMMIT_MSG=$(git log -1 --pretty=%B | head -1)
|
|
||||||
echo "short_sha=${SHORT_SHA}" >> $GITHUB_OUTPUT
|
echo "short_sha=${SHORT_SHA}" >> $GITHUB_OUTPUT
|
||||||
echo "commit_msg=${COMMIT_MSG}" >> $GITHUB_OUTPUT
|
echo "commit_msg=${COMMIT_MSG}" >> $GITHUB_OUTPUT
|
||||||
echo "Building: ${SHORT_SHA} - ${COMMIT_MSG}"
|
echo "Building: ${SHORT_SHA} - ${COMMIT_MSG}"
|
||||||
@@ -37,7 +33,6 @@ jobs:
|
|||||||
|
|
||||||
- name: Build image
|
- name: Build image
|
||||||
run: |
|
run: |
|
||||||
cd /workspace
|
|
||||||
docker build \
|
docker build \
|
||||||
--tag forgejo.riotpiao.com/rock/poimen-memory:${{ steps.info.outputs.short_sha }} \
|
--tag forgejo.riotpiao.com/rock/poimen-memory:${{ steps.info.outputs.short_sha }} \
|
||||||
--tag forgejo.riotpiao.com/rock/poimen-memory:latest \
|
--tag forgejo.riotpiao.com/rock/poimen-memory:latest \
|
||||||
|
|||||||
Reference in New Issue
Block a user