Compare commits
3 commits
392729c2d4
...
3adbea7d44
| Author | SHA1 | Date | |
|---|---|---|---|
| 3adbea7d44 | |||
| 6bae4d3eab | |||
| 90f5454edf |
2 changed files with 11 additions and 49 deletions
|
|
@ -25,7 +25,7 @@ jobs:
|
||||||
|
|
||||||
- name: Copy frontend to host pages mount
|
- name: Copy frontend to host pages mount
|
||||||
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||||
run: |
|
uses: http://forgejo:3000/andras/ci-actions/deploy-pages@main
|
||||||
apt update && apt install -y rsync
|
with:
|
||||||
mkdir -p /pages
|
source: frontend
|
||||||
rsync -a --delete frontend/ /pages/fizika
|
target: fizika
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,6 @@ on:
|
||||||
branches: ['main']
|
branches: ['main']
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
env:
|
|
||||||
IMAGE_NAME: ${{ forgejo.repository }}/fizika-admin
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-push:
|
build-and-push:
|
||||||
runs-on: docker
|
runs-on: docker
|
||||||
|
|
@ -19,45 +16,10 @@ jobs:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: https://code.forgejo.org/actions/checkout@v4
|
uses: https://code.forgejo.org/actions/checkout@v4
|
||||||
|
|
||||||
- name: Extract registry host
|
- name: Build and publish admin image
|
||||||
id: registry
|
uses: http://forgejo:3000/andras/ci-actions/docker-publish@main
|
||||||
run: echo "host=$(echo '${{ forgejo.server_url }}' | sed 's|https\?://||')" >> "$GITHUB_OUTPUT"
|
with:
|
||||||
|
context: ./backend
|
||||||
- name: Log into Forgejo registry
|
image-suffix: /fizika-admin
|
||||||
if: forgejo.event_name != 'pull_request'
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
run: echo "${{ secrets.FORGEJO_PACKAGE_TOKEN }}" | docker login "${{ steps.registry.outputs.host }}" -u "${{ forgejo.actor }}" --password-stdin
|
token: ${{ secrets.FORGEJO_PACKAGE_TOKEN }}
|
||||||
|
|
||||||
- name: Build Docker image
|
|
||||||
run: |
|
|
||||||
IMAGE="${{ steps.registry.outputs.host }}/$(echo "${{ env.IMAGE_NAME }}" | tr '[:upper:]' '[:lower:]')"
|
|
||||||
SHA_SHORT="$(echo "${{ forgejo.sha }}" | cut -c1-12)"
|
|
||||||
TAG_ARGS="-t ${IMAGE}:sha-${SHA_SHORT}"
|
|
||||||
|
|
||||||
if [ "${{ forgejo.ref }}" = "refs/heads/main" ]; then
|
|
||||||
TAG_ARGS="${TAG_ARGS} -t ${IMAGE}:main -t ${IMAGE}:latest"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "${{ forgejo.ref_type }}" = "tag" ]; then
|
|
||||||
REF_NAME="${{ forgejo.ref_name }}"
|
|
||||||
TAG_ARGS="${TAG_ARGS} -t ${IMAGE}:${REF_NAME}"
|
|
||||||
|
|
||||||
if echo "$REF_NAME" | grep -Eq '^v[0-9]+\.[0-9]+\.[0-9]+$'; then
|
|
||||||
VERSION="${REF_NAME#v}"
|
|
||||||
MAJOR_MINOR="$(echo "$VERSION" | cut -d. -f1,2)"
|
|
||||||
MAJOR="$(echo "$VERSION" | cut -d. -f1)"
|
|
||||||
TAG_ARGS="${TAG_ARGS} -t ${IMAGE}:${VERSION} -t ${IMAGE}:${MAJOR_MINOR} -t ${IMAGE}:${MAJOR}"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
docker build \
|
|
||||||
--label "org.opencontainers.image.source=${{ forgejo.server_url }}/${{ forgejo.repository }}" \
|
|
||||||
--label "org.opencontainers.image.revision=${{ forgejo.sha }}" \
|
|
||||||
--label "org.opencontainers.image.created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" \
|
|
||||||
${TAG_ARGS} \
|
|
||||||
./backend
|
|
||||||
|
|
||||||
echo "IMAGE=${IMAGE}" >> "$GITHUB_ENV"
|
|
||||||
|
|
||||||
- name: Push Docker image
|
|
||||||
if: forgejo.event_name != 'pull_request'
|
|
||||||
run: docker push --all-tags "$IMAGE"
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue