diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b19f39e1..fe50d5ac 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,15 +1,6 @@ name: Build Addon on: - push: - branches: - - main - paths: - - 'packages/**' - - 'package-lock.json' - - 'package.json' - - 'tsconfig.json' - - 'tsconfig.base.json' pull_request: branches: - main diff --git a/.github/workflows/deploy-docker.yml b/.github/workflows/deploy-docker.yml index 5c1e6aea..ba0a3771 100644 --- a/.github/workflows/deploy-docker.yml +++ b/.github/workflows/deploy-docker.yml @@ -1,62 +1,90 @@ -name: Deploy Docker image to GitHub Container Registry and Docker Hub +name: Build and Deploy Docker Images on: - push: - tags: - - 'v*' # Trigger on any tag that starts with 'v' - branches: - - main # Trigger on push to main branch + workflow_dispatch: + inputs: + ref: + description: Git Ref + required: true + type: string jobs: - docker: + build: + name: build runs-on: ubuntu-latest + permissions: + packages: write + contents: read steps: - # Checkout the repository - - name: Checkout repository + - name: Checkout uses: actions/checkout@v4 - - # Set up QEMU for multi-platform builds - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - # Set up Docker Buildx - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - # Log in to GitHub Container Registry (GHCR) - - name: Log in to GitHub Container Registry - uses: docker/login-action@v3 with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + fetch-depth: 0 + ref: ${{inputs.ref}} + token: ${{ secrets.GITHUB_TOKEN }} - # Log in to Docker Hub - - name: Log in to Docker Hub - if: startsWith(github.ref, 'refs/tags/v') + - name: Login to Docker Hub uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - # Build and push Docker image to both GHCR and Docker Hub - - name: Build and push Docker image (tags) - if: startsWith(github.ref, 'refs/tags/v') - uses: docker/build-push-action@v6 + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 with: - platforms: linux/amd64,linux/arm64 - push: true - tags: | - ghcr.io/viren070/aiostreams:${{ github.ref_name }} - ghcr.io/viren070/aiostreams:latest - docker.io/${{ secrets.DOCKERHUB_USERNAME }}/aiostreams:${{ github.ref_name }} - docker.io/${{ secrets.DOCKERHUB_USERNAME }}/aiostreams:latest + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} - # Build and push Docker image to GHCR only for each commit to main branch - - name: Build and push Docker image (dev) - if: github.ref == 'refs/heads/main' && github.event_name == 'push' + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Buildx + uses: docker/setup-buildx-action@v3 + + - name: Calculate Image Tags + env: + INPUT_REF: ${{inputs.ref}} + run: | + declare TAGS="" + case "${INPUT_REF}" in + v[0-9]*.[0-9]*.[0-9]*) + TAGS="${INPUT_REF}" + if [[ "$(git rev-parse origin/main)" = "$(git rev-parse "${INPUT_REF}")" ]]; then + TAGS="${TAGS} latest" + fi + ;; + [0-9]*.[0-9]*.[0-9]*-nightly) + TAGS="${INPUT_REF} nightly" + ;; + *) + echo "Invalid Input Ref: ${INPUT_REF}" + exit 1 + esac + + if [[ -z "${TAGS}" ]]; then + echo "Empty Tags!" + exit 1 + fi + + { + echo 'DOCKER_IMAGE_TAGS<> "${GITHUB_ENV}" + + cat "${GITHUB_ENV}" + + - name: Build & Push uses: docker/build-push-action@v6 with: + cache-from: type=gha + cache-to: type=gha,mode=max platforms: linux/amd64,linux/arm64 push: true - tags: ghcr.io/viren070/aiostreams:dev + context: . + file: ./Dockerfile + tags: ${{env.DOCKER_IMAGE_TAGS}} diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml new file mode 100644 index 00000000..28231548 --- /dev/null +++ b/.github/workflows/nightly.yml @@ -0,0 +1,57 @@ +name: Nightly Builds + +on: + push: + branches: [main] + +jobs: + release: + name: release + if: ${{ github.ref == 'refs/heads/main' }} + runs-on: ubuntu-latest + permissions: + actions: write + contents: write + pull-requests: write + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Generate timestamp tag + id: gen_tag + run: | + TIMESTAMP=$(date '+%Y.%m.%d.%H%M-nightly') + echo "tag_name=$TIMESTAMP" >> $GITHUB_OUTPUT + + - name: Create git tag + env: + TAG_NAME: ${{ steps.gen_tag.outputs.tag_name }} + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git tag $TAG_NAME + git push origin $TAG_NAME + + - name: Get commit message + id: commit_msg + run: | + COMMIT_MSG=$(git log -1 --pretty=%B) + echo "commit_msg<> $GITHUB_OUTPUT + echo "$COMMIT_MSG" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + + - name: Create GitHub prerelease + env: + GH_TOKEN: ${{ github.token }} + run: | + gh release create "${{ steps.gen_tag.outputs.tag_name }}" \ + --repo "${GITHUB_REPOSITORY}" \ + --title "Nightly Build ${{ steps.gen_tag.outputs.tag_name }}" \ + --notes "${{ steps.commit_msg.outputs.commit_msg }}" \ + --prerelease + + - name: Trigger Docker Image Publish + env: + GH_TOKEN: ${{ github.token }} + run: | + gh workflow run --repo ${GITHUB_REPOSITORY} deploy-docker.yml -f ref=${{ steps.gen_tag.outputs.tag_name }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..b706dab7 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,31 @@ +name: Release + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + release: + name: release + if: ${{ github.ref == 'refs/heads/main' }} + runs-on: ubuntu-latest + permissions: + actions: write + contents: write + pull-requests: write + steps: + - name: Release + id: release + uses: google-github-actions/release-please-action@v4 + # with: + # token: ${{ secrets.RELEASE_PLEASE_TOKEN }} + + - name: Trigger Docker Image Publish + if: ${{ steps.release.outputs['release_created'] }} + env: + GH_TOKEN: ${{ github.token }} + TAG_NAME: ${{ steps.release.outputs.tag_name }} + run: | + gh workflow run --repo ${GITHUB_REPOSITORY} deploy-docker.yml -f ref=${TAG_NAME} diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 00000000..9e1cdeda --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "1.21.1" +} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 491fab41..00000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,14 +0,0 @@ -# Changelog - -All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines. - -## [1.14.2](https://github.com/Viren070/aiostreams/compare/v1.14.1...v1.14.2) (2025-03-18) - - -### Bug Fixes - -* attempt to fix release.yml ([960de88](https://github.com/Viren070/aiostreams/commit/960de88cc59304bde772be86d75e2ab88b48d1b6)) -* **easynews-plus:** encode easynews credentials ([71f2ad4](https://github.com/Viren070/aiostreams/commit/71f2ad434fa0bbbfaf93ec489b48752d8ee6f3a1)) -* **easynews:** encode easynews credentials ([e8cd4a4](https://github.com/Viren070/aiostreams/commit/e8cd4a49a058f1b4035b23824cde490c2c598013)) -* extract config string for custom configs when determining whether to encrypt sensitive information ([57649f0](https://github.com/Viren070/aiostreams/commit/57649f07f657941abe3fefd01a2c5b7462b11382)) -* filter out zero counts from skip reasons in logs ([d0db4db](https://github.com/Viren070/aiostreams/commit/d0db4dbf91c415405702f8e64af901f97a60f5b4)) diff --git a/packages/addon/src/manifest.ts b/packages/addon/src/manifest.ts index 891bce51..4c828b60 100644 --- a/packages/addon/src/manifest.ts +++ b/packages/addon/src/manifest.ts @@ -1,5 +1,5 @@ import { Config } from '@aiostreams/types'; -import { version, description } from '../package.json'; +import { version, description } from '../../../package.json'; import { getTextHash, Settings } from '@aiostreams/utils'; const manifest = (config?: Config, configPresent?: boolean) => { diff --git a/packages/frontend/src/app/configure/page.tsx b/packages/frontend/src/app/configure/page.tsx index d9c72963..028e4420 100644 --- a/packages/frontend/src/app/configure/page.tsx +++ b/packages/frontend/src/app/configure/page.tsx @@ -21,7 +21,7 @@ import ServiceInput from '../../components/ServiceInput'; import AddonsList from '../../components/AddonsList'; import { Slide, ToastContainer, toast } from 'react-toastify'; import showToast, { toastOptions } from '@/components/Toasts'; -import addonPackage from '../../../package.json'; +import addonPackage from '../../../../../package.json'; import { formatSize } from '@aiostreams/formatters'; import { allowedFormatters, diff --git a/packages/utils/src/settings.ts b/packages/utils/src/settings.ts index 77fbf35b..a4b3ef30 100644 --- a/packages/utils/src/settings.ts +++ b/packages/utils/src/settings.ts @@ -1,6 +1,6 @@ import dotenv from 'dotenv'; import path from 'path'; -import p from '../package.json'; +import p from '../../../package.json'; import { cleanEnv, str, diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 00000000..7d21dead --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,20 @@ +{ + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/refs/heads/main/schemas/config.json", + "release-type": "simple", + "bump-minor-pre-major": true, + "include-v-in-tag": true, + "packages": { + ".": { + "release-type": "node", + "include-component-in-tag": false, + "exclude-paths": [ + ".env.sample", + ".gitignore", + ".release-please-manifest.json", + "compose.yaml", + "release-please-config.json" + ], + "pull-request-title-pattern": "chore: release ${version}" + } + } +} \ No newline at end of file