Files
poimen-memory/.gitea/workflows/build.yaml
Story Crater Bot ed702fc800
Build and Push / Test (push) Successful in 3m34s
Build and Push / Build and push image (push) Failing after 27s
fix(ci): use git clone instead of actions/checkout (no node in rust image)
2026-08-23 17:35:45 -07:00

69 lines
1.7 KiB
YAML

name: Build and Push
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
REGISTRY: forgejo.riotpiao.com
IMAGE: forgejo.riotpiao.com/rock/poimen-memory
jobs:
test:
name: Test
runs-on: rust
steps:
- name: Clone repo
run: |
git clone --depth 1 --branch ${{ github.ref_name }} \
${{ github.server_url }}/${{ github.repository }}.git .
- name: Run tests
run: cargo test --all
build:
name: Build and push image
runs-on: golang
needs: test
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
container:
image: docker:27-cli
volumes:
- /docker-certs/client:/docker-certs/client:ro
env:
DOCKER_HOST: tcp://localhost:2376
DOCKER_TLS_VERIFY: "1"
DOCKER_CERT_PATH: /docker-certs/client
steps:
- name: install node (required by JS-based actions)
run: apk add --no-cache nodejs git
- uses: actions/checkout@v4
- name: Get short SHA
id: sha
run: |
SHORT_SHA=$(git rev-parse --short HEAD)
echo "short_sha=${SHORT_SHA}" >> $GITHUB_OUTPUT
- name: Registry login
run: |
echo "${REGISTRY_PAT}" | docker login "${REGISTRY}" \
--username rock --password-stdin
env:
REGISTRY_PAT: ${{ secrets.REGISTRY_PAT }}
- name: Build
run: |
docker build \
-t "${IMAGE}:${{ steps.sha.outputs.short_sha }}" \
-t "${IMAGE}:latest" \
.
- name: Push
run: |
docker push "${IMAGE}:${{ steps.sha.outputs.short_sha }}"
docker push "${IMAGE}:latest"