ci: use release-please, remove dev tag, add nightly builds

This commit is contained in:
Viren070
2025-05-22 21:40:33 +01:00
parent 72b5ab648e
commit 181295dd61
10 changed files with 184 additions and 68 deletions
-9
View File
@@ -1,15 +1,6 @@
name: Build Addon name: Build Addon
on: on:
push:
branches:
- main
paths:
- 'packages/**'
- 'package-lock.json'
- 'package.json'
- 'tsconfig.json'
- 'tsconfig.base.json'
pull_request: pull_request:
branches: branches:
- main - main
+70 -42
View File
@@ -1,62 +1,90 @@
name: Deploy Docker image to GitHub Container Registry and Docker Hub name: Build and Deploy Docker Images
on: on:
push: workflow_dispatch:
tags: inputs:
- 'v*' # Trigger on any tag that starts with 'v' ref:
branches: description: Git Ref
- main # Trigger on push to main branch required: true
type: string
jobs: jobs:
docker: build:
name: build
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps: steps:
# Checkout the repository - name: Checkout
- name: Checkout repository
uses: actions/checkout@v4 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: with:
registry: ghcr.io fetch-depth: 0
username: ${{ github.actor }} ref: ${{inputs.ref}}
password: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
# Log in to Docker Hub - name: Login to Docker Hub
- name: Log in to Docker Hub
if: startsWith(github.ref, 'refs/tags/v')
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
username: ${{ secrets.DOCKERHUB_USERNAME }} username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN }}
# Build and push Docker image to both GHCR and Docker Hub - name: Login to GitHub Container Registry
- name: Build and push Docker image (tags) uses: docker/login-action@v3
if: startsWith(github.ref, 'refs/tags/v')
uses: docker/build-push-action@v6
with: with:
platforms: linux/amd64,linux/arm64 registry: ghcr.io
push: true username: ${{ github.repository_owner }}
tags: | password: ${{ secrets.GITHUB_TOKEN }}
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
# Build and push Docker image to GHCR only for each commit to main branch - name: Set up QEMU
- name: Build and push Docker image (dev) uses: docker/setup-qemu-action@v3
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
- 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<<EOF'
for tag in ${TAGS}; do
echo "viren070/aiostreams:${tag}"
echo "ghcr.io/viren070/aiostreams:${tag}"
done
echo EOF
} >> "${GITHUB_ENV}"
cat "${GITHUB_ENV}"
- name: Build & Push
uses: docker/build-push-action@v6 uses: docker/build-push-action@v6
with: with:
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64
push: true push: true
tags: ghcr.io/viren070/aiostreams:dev context: .
file: ./Dockerfile
tags: ${{env.DOCKER_IMAGE_TAGS}}
+57
View File
@@ -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<<EOF" >> $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 }}
+31
View File
@@ -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}
+3
View File
@@ -0,0 +1,3 @@
{
".": "1.21.1"
}
-14
View File
@@ -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))
+1 -1
View File
@@ -1,5 +1,5 @@
import { Config } from '@aiostreams/types'; import { Config } from '@aiostreams/types';
import { version, description } from '../package.json'; import { version, description } from '../../../package.json';
import { getTextHash, Settings } from '@aiostreams/utils'; import { getTextHash, Settings } from '@aiostreams/utils';
const manifest = (config?: Config, configPresent?: boolean) => { const manifest = (config?: Config, configPresent?: boolean) => {
+1 -1
View File
@@ -21,7 +21,7 @@ import ServiceInput from '../../components/ServiceInput';
import AddonsList from '../../components/AddonsList'; import AddonsList from '../../components/AddonsList';
import { Slide, ToastContainer, toast } from 'react-toastify'; import { Slide, ToastContainer, toast } from 'react-toastify';
import showToast, { toastOptions } from '@/components/Toasts'; import showToast, { toastOptions } from '@/components/Toasts';
import addonPackage from '../../../package.json'; import addonPackage from '../../../../../package.json';
import { formatSize } from '@aiostreams/formatters'; import { formatSize } from '@aiostreams/formatters';
import { import {
allowedFormatters, allowedFormatters,
+1 -1
View File
@@ -1,6 +1,6 @@
import dotenv from 'dotenv'; import dotenv from 'dotenv';
import path from 'path'; import path from 'path';
import p from '../package.json'; import p from '../../../package.json';
import { import {
cleanEnv, cleanEnv,
str, str,
+20
View File
@@ -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}"
}
}
}