diff --git a/.gitea/workflows/backend.yml b/.gitea/workflows/backend.yml index 6261641..d97f3c8 100644 --- a/.gitea/workflows/backend.yml +++ b/.gitea/workflows/backend.yml @@ -19,49 +19,56 @@ jobs: steps: - name: Install Git and Docker CLI run: apk add --no-cache git docker-cli docker-cli-buildx - - name: Log in to Gitea Container Registry # This uses the automated token provided natively by Gitea Actions run: echo "${{ secrets.babymonitor_cicd }}" | docker login gitea.lan -u ${{ github.actor }} --password-stdin - - name: Create Custom Buildx Builder for HTTP run: | # 1. Write a configuration rule forcing plain HTTP for your local domain echo '[registry."gitea.lan"]' > buildkitd.toml echo ' http = true' >> buildkitd.toml - # 2. Tell buildx to create and use a builder with this rule docker buildx create --use --name local-http-builder --config buildkitd.toml + - name: Checkout + uses: actions/checkout@v4 + with: + # Tells the action to use the local 'git' binary we just installed + set-safe-directory: 'true' + fetch-depth: 0 + - name: Determine Version + run: | + LATEST_TAG=$(git tag -l "v${{ env.MAJOR }}.${{ env.MINOR }}.*" | sort -V | tail -n 1) + if [ -z "$LATEST_TAG" ]; then + VERSION="v${{ env.MAJOR }}.${{ env.MINOR }}.0" + else + # Strip the 'v' if present and get the patch version + PATCH=$(echo "$LATEST_TAG" | sed 's/v//' | cut -d'.' -f3) + NEW_PATCH=$((PATCH + 1)) + VERSION="v${{ env.MAJOR }}.${{ env.MINOR }}.$NEW_PATCH" + fi + echo "VERSION=$VERSION" >> "$GITHUB_ENV" + - name: Build Docker image + run: | + docker buildx build \ + --platform linux/arm64 \ + -t gitea.lan/jacobh2/babymonitor-backend:${{ env.VERSION }} \ + ./backend \ + --push + - name: Tag and Push Version + run: | + git tag "$VERSION" + git push origin "$VERSION" - - name: Checkout - uses: actions/checkout@v3 - with: - # Tells the action to use the local 'git' binary we just installed - set-safe-directory: 'true' - fetch-depth: 0 - - - name: Determine Version - run: | - LATEST_TAG=$(git tag -l "v${{ env.MAJOR }}.${{ env.MINOR }}.*" | sort -V | tail -n 1) - if [ -z "$LATEST_TAG" ]; then - VERSION="v${{ env.MAJOR }}.${{ env.MINOR }}.0" - else - # Strip the 'v' if present and get the patch version - PATCH=$(echo "$LATEST_TAG" | sed 's/v//' | cut -d'.' -f3) - NEW_PATCH=$((PATCH + 1)) - VERSION="v${{ env.MAJOR }}.${{ env.MINOR }}.$NEW_PATCH" - fi - echo "VERSION=$VERSION" >> $GITHUB_ENV - - - name: Build Docker image - run: | - docker buildx build \ - --platform linux/arm64 \ - -t gitea.lan/jacobh2/babymonitor-backend:${{ env.VERSION }} \ - ./backend \ - --push - - - name: Tag and Push Version - run: | -git tag $VERSION -git push origin $VERSION + lint: + runs-on: host + steps: + - uses: actions/checkout@v4 + - name: Run actionlint + run: | + # Trying to install it via apk if possible, otherwise fallback + apk add --no-cache actionlint || echo "actionlint not found in apk" + if command -v actionlint >/dev/null 2>&1; then + actionlint .gitea/workflows/*.yml + else + echo "Skipping actionlint: not installed" + fi diff --git a/.gitea/workflows/frontend.yml b/.gitea/workflows/frontend.yml index dc4fb0a..cbcc5a4 100644 --- a/.gitea/workflows/frontend.yml +++ b/.gitea/workflows/frontend.yml @@ -19,49 +19,56 @@ jobs: steps: - name: Install Git and Docker CLI run: apk add --no-cache git docker-cli docker-cli-buildx - - name: Log in to Gitea Container Registry # This uses the automated token provided natively by Gitea Actions run: echo "${{ secrets.babymonitor_cicd }}" | docker login gitea.lan -u ${{ github.actor }} --password-stdin - - name: Create Custom Buildx Builder for HTTP run: | # 1. Write a configuration rule forcing plain HTTP for your local domain echo '[registry."gitea.lan"]' > buildkitd.toml echo ' http = true' >> buildkitd.toml - # 2. Tell buildx to create and use a builder with this rule docker buildx create --use --name local-http-builder --config buildkitd.toml + - name: Checkout + uses: actions/checkout@v4 + with: + # Tells the action to use the local 'git' binary we just installed + set-safe-directory: 'true' + fetch-depth: 0 + - name: Determine Version + run: | + LATEST_TAG=$(git tag -l "v${{ env.MAJOR }}.${{ env.MINOR }}.*" | sort -V | tail -n 1) + if [ -z "$LATEST_TAG" ]; then + VERSION="v${{ env.MAJOR }}.${{ env.MINOR }}.0" + else + # Strip the 'v' if present and get the patch version + PATCH=$(echo "$LATEST_TAG" | sed 's/v//' | cut -d'.' -f3) + NEW_PATCH=$((PATCH + 1)) + VERSION="v${{ env.MAJOR }}.${{ env.MINOR }}.$NEW_PATCH" + fi + echo "VERSION=$VERSION" >> "$GITHUB_ENV" + - name: Build Docker image + run: | + docker buildx build \ + --platform linux/arm64 \ + -t gitea.lan/jacobh2/babymonitor-frontend:${{ env.VERSION }} \ + ./frontend \ + --push + - name: Tag and Push Version + run: | + git tag "$VERSION" + git push origin "$VERSION" - - name: Checkout - uses: actions/checkout@v3 - with: - # Tells the action to use the local 'git' binary we just installed - set-safe-directory: 'true' - fetch-depth: 0 - - - name: Determine Version - run: | - LATEST_TAG=$(git tag -l "v${{ env.MAJOR }}.${{ env.MINOR }}.*" | sort -V | tail -n 1) - if [ -z "$LATEST_TAG" ]; then - VERSION="v${{ env.MAJOR }}.${{ env.MINOR }}.0" - else - # Strip the 'v' if present and get the patch version - PATCH=$(echo "$LATEST_TAG" | sed 's/v//' | cut -d'.' -f3) - NEW_PATCH=$((PATCH + 1)) - VERSION="v${{ env.MAJOR }}.${{ env.MINOR }}.$NEW_PATCH" - fi - echo "VERSION=$VERSION" >> $GITHUB_ENV - - - name: Build Docker image - run: | - docker buildx build \ - --platform linux/arm64 \ - -t gitea.lan/jacobh2/babymonitor-frontend:${{ env.VERSION }} \ - ./frontend \ - --push - - - name: Tag and Push Version - run: | -git tag $VERSION -git push origin $VERSION + lint: + runs-on: host + steps: + - uses: actions/checkout@v4 + - name: Run actionlint + run: | + # Trying to install it via apk if possible, otherwise fallback + apk add --no-cache actionlint || echo "actionlint not found in apk" + if command -v actionlint >/dev/null 2>&1; then + actionlint .gitea/workflows/*.yml + else + echo "Skipping actionlint: not installed" + fi