mirror of
https://github.com/r3bo0tbx1/tor-guard-relay.git
synced 2026-04-06 00:32:04 +02:00
fix: rebuild release.yml + Dockerfile normalization for v1.0.3
This commit is contained in:
51
.github/workflows/release.yml
vendored
51
.github/workflows/release.yml
vendored
@@ -47,30 +47,27 @@ jobs:
|
||||
- name: 🔍 Detect Version & Build Type
|
||||
id: version
|
||||
run: |
|
||||
# Check if this is a manual tag push
|
||||
set -e
|
||||
echo "🧩 Determining version context..."
|
||||
if [[ "${GITHUB_REF}" == refs/tags/v* ]]; then
|
||||
# Extract version from tag (v1.2.3 -> 1.2.3)
|
||||
VERSION="${GITHUB_REF#refs/tags/v}"
|
||||
BUILD_TYPE="release"
|
||||
IS_RELEASE="true"
|
||||
echo "🎯 Manual release tag detected: v${VERSION}"
|
||||
echo "🎯 Release tag detected: v${VERSION}"
|
||||
elif [[ "${GITHUB_EVENT_NAME}" == "workflow_dispatch" ]]; then
|
||||
# Manual workflow dispatch
|
||||
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v1.0.0")
|
||||
VERSION="${LATEST_TAG#v}-manual-${GITHUB_RUN_NUMBER}"
|
||||
BUILD_TYPE="manual"
|
||||
IS_RELEASE="false"
|
||||
echo "🔧 Manual build: ${VERSION}"
|
||||
echo "🔧 Manual build version: ${VERSION}"
|
||||
else
|
||||
# Weekly scheduled build
|
||||
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v1.0.0")
|
||||
VERSION="${LATEST_TAG#v}"
|
||||
BUILD_TYPE="weekly"
|
||||
IS_RELEASE="false"
|
||||
echo "📅 Weekly build for version: ${VERSION}"
|
||||
echo "📅 Weekly build version: ${VERSION}"
|
||||
fi
|
||||
|
||||
# Generate build metadata
|
||||
BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
|
||||
SHORT_SHA=$(git rev-parse --short HEAD)
|
||||
|
||||
@@ -82,30 +79,45 @@ jobs:
|
||||
|
||||
- name: ✅ Version Information
|
||||
run: |
|
||||
echo "Build Information:"
|
||||
echo "Build Info:"
|
||||
echo " Version: ${{ steps.version.outputs.version }}"
|
||||
echo " Build Type: ${{ steps.version.outputs.build_type }}"
|
||||
echo " Is Release: ${{ steps.version.outputs.is_release }}"
|
||||
echo " Build Date: ${{ steps.version.outputs.build_date }}"
|
||||
echo " Git SHA: ${{ steps.version.outputs.short_sha }}"
|
||||
echo " Release: ${{ steps.version.outputs.is_release }}"
|
||||
echo " Date: ${{ steps.version.outputs.build_date }}"
|
||||
echo " SHA: ${{ steps.version.outputs.short_sha }}"
|
||||
|
||||
build-and-push:
|
||||
name: 🐳 Multi-Arch Build & Push
|
||||
runs-on: ubuntu-latest
|
||||
needs: determine-version
|
||||
if: ${{ needs.determine-version.result == 'success' }}
|
||||
|
||||
steps:
|
||||
- name: 📥 Checkout Repository
|
||||
uses: actions/checkout@v5
|
||||
|
||||
<<<<<<< Updated upstream
|
||||
# 🆕 Login to Docker Hub
|
||||
=======
|
||||
- name: 🧹 Normalize scripts before build
|
||||
run: |
|
||||
sudo apt-get update -qq && sudo apt-get install -y dos2unix
|
||||
find . -type f -name "*.sh" -exec dos2unix {} \;
|
||||
dos2unix docker-entrypoint.sh integration-check.sh Dockerfile || true
|
||||
chmod +x docker-entrypoint.sh integration-check.sh || true
|
||||
echo "✅ Line endings normalized and permissions verified."
|
||||
|
||||
>>>>>>> Stashed changes
|
||||
- name: 🔐 Login to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
<<<<<<< Updated upstream
|
||||
# Existing GHCR login
|
||||
=======
|
||||
>>>>>>> Stashed changes
|
||||
- name: 🔐 Login to GitHub Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
@@ -129,6 +141,7 @@ jobs:
|
||||
BUILD_TYPE="${{ needs.determine-version.outputs.build_type }}"
|
||||
SHORT_SHA="${{ needs.determine-version.outputs.short_sha }}"
|
||||
|
||||
<<<<<<< Updated upstream
|
||||
# Initialize tags array
|
||||
TAGS=""
|
||||
|
||||
@@ -176,6 +189,15 @@ jobs:
|
||||
echo "🔧 Manual tags (both registries):"
|
||||
echo " - ${VERSION}"
|
||||
echo " - ${VERSION}-${SHORT_SHA}"
|
||||
=======
|
||||
TAGS=""
|
||||
if [ "$BUILD_TYPE" = "release" ]; then
|
||||
TAGS="${{ env.GHCR_REGISTRY }}/${{ env.GHCR_IMAGE_NAME }}:latest,${{ env.GHCR_REGISTRY }}/${{ env.GHCR_IMAGE_NAME }}:${VERSION},${{ env.GHCR_REGISTRY }}/${{ env.GHCR_IMAGE_NAME }}:${VERSION}-${SHORT_SHA},${{ env.DOCKERHUB_IMAGE_NAME }}:latest,${{ env.DOCKERHUB_IMAGE_NAME }}:${VERSION},${{ env.DOCKERHUB_IMAGE_NAME }}:${VERSION}-${SHORT_SHA}"
|
||||
elif [ "$BUILD_TYPE" = "weekly" ]; then
|
||||
TAGS="${{ env.GHCR_REGISTRY }}/${{ env.GHCR_IMAGE_NAME }}:${VERSION}-weekly,${{ env.GHCR_REGISTRY }}/${{ env.GHCR_IMAGE_NAME }}:${VERSION}-${SHORT_SHA},${{ env.DOCKERHUB_IMAGE_NAME }}:${VERSION}-weekly,${{ env.DOCKERHUB_IMAGE_NAME }}:${VERSION}-${SHORT_SHA}"
|
||||
else
|
||||
TAGS="${{ env.GHCR_REGISTRY }}/${{ env.GHCR_IMAGE_NAME }}:${VERSION},${{ env.GHCR_REGISTRY }}/${{ env.GHCR_IMAGE_NAME }}:${VERSION}-${SHORT_SHA},${{ env.DOCKERHUB_IMAGE_NAME }}:${VERSION},${{ env.DOCKERHUB_IMAGE_NAME }}:${VERSION}-${SHORT_SHA}"
|
||||
>>>>>>> Stashed changes
|
||||
fi
|
||||
|
||||
echo "tags=${TAGS}" >> "$GITHUB_OUTPUT"
|
||||
@@ -193,6 +215,7 @@ jobs:
|
||||
BUILD_VERSION=${{ needs.determine-version.outputs.version }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
<<<<<<< Updated upstream
|
||||
labels: |
|
||||
org.opencontainers.image.title=Tor Guard Relay
|
||||
org.opencontainers.image.description=Hardened Tor Guard Relay with diagnostics
|
||||
@@ -433,4 +456,6 @@ jobs:
|
||||
run: |
|
||||
echo "❌ Release workflow failed"
|
||||
echo "Check the logs above for details"
|
||||
exit 1
|
||||
exit 1
|
||||
=======
|
||||
>>>>>>> Stashed changes
|
||||
|
||||
28
Dockerfile
28
Dockerfile
@@ -77,21 +77,21 @@ COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
|
||||
COPY tools/ /usr/local/bin/
|
||||
|
||||
# ============================================================================
|
||||
# Normalize and harden scripts
|
||||
# Normalize, harden, and alias tools
|
||||
# ============================================================================
|
||||
RUN set -eux; \
|
||||
for f in /usr/local/bin/*; do \
|
||||
[ -f "$f" ] || continue; \
|
||||
tr -d '\r' < "$f" > "$f.tmp" && mv "$f.tmp" "$f"; \
|
||||
sed -i '1s/^\xEF\xBB\xBF//' "$f" || true; \
|
||||
chmod +x "$f"; \
|
||||
done; \
|
||||
echo "🧩 Installed tools:"; \
|
||||
for f in /usr/local/bin/docker-entrypoint* /usr/local/bin/net-check* /usr/local/bin/metrics* \
|
||||
/usr/local/bin/health* /usr/local/bin/view-logs* /usr/local/bin/status* \
|
||||
/usr/local/bin/fingerprint* /usr/local/bin/setup* /usr/local/bin/dashboard*; do \
|
||||
[ -f "$f" ] && echo "Registered script: $f"; \
|
||||
done
|
||||
RUN set -eux \
|
||||
&& apk add --no-cache dos2unix \
|
||||
&& echo "🧩 Normalizing line endings and fixing permissions..." \
|
||||
&& find /usr/local/bin -type f -name "*.sh" -exec dos2unix {} \; || true \
|
||||
&& dos2unix /usr/local/bin/docker-entrypoint.sh || true \
|
||||
&& chmod +x /usr/local/bin/*.sh /usr/local/bin/docker-entrypoint.sh \
|
||||
&& echo "🔗 Creating symlinks for no-extension tool compatibility..." \
|
||||
&& for f in /usr/local/bin/*.sh; do ln -sf "$f" "${f%.sh}"; done \
|
||||
&& echo "✅ Tools normalized, executable, and aliased." \
|
||||
&& echo "🧩 Installed tools:" \
|
||||
&& ls -1 /usr/local/bin | grep -E "docker-entrypoint|net-check|metrics|health|view-logs|status|fingerprint|setup|dashboard" || true \
|
||||
&& apk del dos2unix \
|
||||
&& rm -rf /var/cache/apk/*
|
||||
|
||||
# ============================================================================
|
||||
# Environment configuration
|
||||
|
||||
Reference in New Issue
Block a user