mirror of
https://github.com/jaypyles/Scraperr.git
synced 2025-10-30 05:57:12 +00:00
Compare commits
17 Commits
6c56f2f161
...
53f35989f5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
53f35989f5 | ||
|
|
a67ab34cfa | ||
|
|
3bf6657191 | ||
|
|
c38d19a0ca | ||
|
|
a53e7e1aa1 | ||
|
|
84368b1f6d | ||
|
|
ce4c1ceaa7 | ||
|
|
7e1ce58bb8 | ||
|
|
175e7d63bf | ||
|
|
d2c06de247 | ||
|
|
e0159bf9d4 | ||
|
|
6d574ddfd2 | ||
|
|
b089d72786 | ||
|
|
9ee4d577fd | ||
|
|
cddce5164d | ||
|
|
bf3163bfba | ||
|
|
54b513e92c |
8
.github/actions/push-to-helm/action.yaml
vendored
8
.github/actions/push-to-helm/action.yaml
vendored
@@ -5,6 +5,9 @@ inputs:
|
||||
app-repo-token:
|
||||
required: true
|
||||
description: "The token for the target repository"
|
||||
version:
|
||||
required: true
|
||||
description: "The version of the Helm chart"
|
||||
|
||||
runs:
|
||||
using: 'composite'
|
||||
@@ -15,6 +18,11 @@ runs:
|
||||
- name: Set up Helm
|
||||
uses: azure/setup-helm@v3
|
||||
|
||||
- name: Update Helm chart version
|
||||
run: |
|
||||
sed -i "s/^version: .*/version: ${{ inputs.version }}/" helm/Chart.yaml
|
||||
shell: bash
|
||||
|
||||
- name: Package Helm chart
|
||||
run: |
|
||||
mkdir -p packaged
|
||||
|
||||
26
.github/workflows/docker-image.yml
vendored
26
.github/workflows/docker-image.yml
vendored
@@ -1,6 +1,17 @@
|
||||
name: Docker Image
|
||||
on:
|
||||
workflow_dispatch:
|
||||
workflow_call:
|
||||
inputs:
|
||||
version:
|
||||
required: true
|
||||
type: string
|
||||
secrets:
|
||||
dockerhub_username:
|
||||
required: true
|
||||
dockerhub_token:
|
||||
required: true
|
||||
repo_token:
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
build:
|
||||
@@ -9,11 +20,9 @@ jobs:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Get version from helm chart
|
||||
- name: Echo version
|
||||
run: |
|
||||
VERSION=$(grep "version:" ./helm/Chart.yaml | cut -d: -f2 | tr -d ' ')
|
||||
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
||||
echo "Version is $VERSION"
|
||||
echo "Version is ${{ inputs.version }}"
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
@@ -32,7 +41,7 @@ jobs:
|
||||
push: true
|
||||
tags: |
|
||||
${{ secrets.DOCKERHUB_USERNAME }}/scraperr:latest
|
||||
${{ secrets.DOCKERHUB_USERNAME }}/scraperr:${{ env.VERSION }}
|
||||
${{ secrets.DOCKERHUB_USERNAME }}/scraperr:${{ inputs.version }}
|
||||
|
||||
- name: Build and push api
|
||||
uses: docker/build-push-action@v5
|
||||
@@ -42,7 +51,7 @@ jobs:
|
||||
push: true
|
||||
tags: |
|
||||
${{ secrets.DOCKERHUB_USERNAME }}/scraperr_api:latest
|
||||
${{ secrets.DOCKERHUB_USERNAME }}/scraperr_api:${{ env.VERSION }}
|
||||
${{ secrets.DOCKERHUB_USERNAME }}/scraperr_api:${{ inputs.version }}
|
||||
|
||||
push-helm-chart:
|
||||
runs-on: ubuntu-latest
|
||||
@@ -54,7 +63,8 @@ jobs:
|
||||
- name: Push Helm Chart
|
||||
uses: ./.github/actions/push-to-helm
|
||||
with:
|
||||
app-repo-token: ${{ secrets.GPAT_TOKEN }}
|
||||
app-repo-token: ${{ secrets.repo_token }}
|
||||
version: ${{ inputs.version }}
|
||||
|
||||
success-message:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
27
.github/workflows/merge.yml
vendored
Normal file
27
.github/workflows/merge.yml
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
name: Merge
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
uses: ./.github/workflows/tests.yml
|
||||
secrets:
|
||||
openai_key: ${{ secrets.OPENAI_KEY }}
|
||||
discord_webhook_url: ${{ secrets.DISCORD_WEBHOOK_URL }}
|
||||
|
||||
version:
|
||||
needs: tests
|
||||
uses: ./.github/workflows/version.yml
|
||||
|
||||
build-and-deploy:
|
||||
needs: version
|
||||
uses: ./.github/workflows/docker-image.yml
|
||||
secrets:
|
||||
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
repo_token: ${{ secrets.GPAT_TOKEN }}
|
||||
with:
|
||||
version: ${{ needs.version.outputs.version }}
|
||||
20
.github/workflows/pr.yml
vendored
Normal file
20
.github/workflows/pr.yml
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
name: PR
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
types: [opened, synchronize, reopened]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
checkout:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
tests:
|
||||
uses: ./.github/workflows/tests.yml
|
||||
secrets:
|
||||
openai_key: ${{ secrets.OPENAI_KEY }}
|
||||
discord_webhook_url: ${{ secrets.DISCORD_WEBHOOK_URL }}
|
||||
@@ -1,14 +1,13 @@
|
||||
name: Unit Tests
|
||||
name: Reusable PR Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
workflow_call:
|
||||
secrets:
|
||||
openai_key:
|
||||
required: true
|
||||
discord_webhook_url:
|
||||
required: true
|
||||
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened]
|
||||
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
unit-tests:
|
||||
@@ -54,7 +53,6 @@ jobs:
|
||||
if: steps.run-tests.outcome == 'failure'
|
||||
run: exit 1
|
||||
|
||||
|
||||
success-message:
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
@@ -64,11 +62,11 @@ jobs:
|
||||
- name: Send Discord Message
|
||||
uses: jaypyles/discord-webhook-action@v1.0.0
|
||||
with:
|
||||
webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }}
|
||||
webhook-url: ${{ secrets.discord_webhook_url }}
|
||||
content: "Scraperr Successfully Passed Tests"
|
||||
username: "Scraperr CI"
|
||||
embed-title: "✅ Deployment Status"
|
||||
embed-description: "Scraperr successfully passed all tests."
|
||||
embed-color: 3066993 # Green
|
||||
embed-color: 3066993
|
||||
embed-footer-text: "Scraperr CI"
|
||||
embed-timestamp: ${{ github.event.head_commit.timestamp }}
|
||||
60
.github/workflows/version.yml
vendored
Normal file
60
.github/workflows/version.yml
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
name: Version
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
outputs:
|
||||
version:
|
||||
description: "The new version number"
|
||||
value: ${{ jobs.version.outputs.version }}
|
||||
|
||||
jobs:
|
||||
version:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
outputs:
|
||||
version: ${{ steps.set_version.outputs.version }}
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Get version bump
|
||||
id: get_version_type
|
||||
run: |
|
||||
COMMIT_MSG=$(git log -1 --pretty=%B)
|
||||
|
||||
if [[ $COMMIT_MSG =~ ^feat\(breaking\) ]]; then
|
||||
VERSION_TYPE="major"
|
||||
elif [[ $COMMIT_MSG =~ ^feat! ]]; then
|
||||
VERSION_TYPE="minor"
|
||||
elif [[ $COMMIT_MSG =~ ^(feat|fix|chore): ]]; then
|
||||
VERSION_TYPE="patch"
|
||||
else
|
||||
VERSION_TYPE="patch"
|
||||
fi
|
||||
|
||||
echo "VERSION_TYPE=$VERSION_TYPE" >> $GITHUB_ENV
|
||||
|
||||
- name: Set version
|
||||
id: set_version
|
||||
run: |
|
||||
VERSION=$(./scripts/version.sh "$VERSION_TYPE")
|
||||
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
||||
echo "Version is $VERSION"
|
||||
echo "::set-output name=version::$VERSION"
|
||||
env:
|
||||
VERSION_TYPE: ${{ env.VERSION_TYPE }}
|
||||
|
||||
- name: Update chart file
|
||||
run: |
|
||||
sed -i "s/^version: .*/version: $VERSION/" helm/Chart.yaml
|
||||
|
||||
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git config --local user.name "github-actions[bot]"
|
||||
git add helm/Chart.yaml
|
||||
git commit -m "chore: bump version to $VERSION"
|
||||
git push
|
||||
env:
|
||||
VERSION: ${{ env.VERSION }}
|
||||
@@ -15,7 +15,7 @@ type: application
|
||||
# This is the chart version. This version number should be incremented each time you make changes
|
||||
# to the chart and its templates, including the app version.
|
||||
# Versions are expected to follow Semantic Versioning (https://semver.org/)
|
||||
version: 1.1.0
|
||||
version: 1.1.1
|
||||
|
||||
# This is the version number of the application being deployed. This version number should be
|
||||
# incremented each time you make changes to the application. Versions are not expected to
|
||||
|
||||
19
scripts/version.sh
Executable file
19
scripts/version.sh
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
# ARGS
|
||||
VERSION_TYPE=$1 # patch, minor, major
|
||||
|
||||
# Get the current version from the Chart.yaml file
|
||||
current_version=$(grep -oP 'version:\s*\K[0-9]+\.[0-9]+\.[0-9]+' helm/Chart.yaml | tr -d '[:space:]')
|
||||
|
||||
# Increment the version number
|
||||
if [ "$VERSION_TYPE" == "patch" ]; then
|
||||
new_version=$(echo $current_version | awk -F. -v OFS=. '{$NF++; print}')
|
||||
elif [ "$VERSION_TYPE" == "minor" ]; then
|
||||
new_version=$(echo $current_version | awk -F. -v OFS=. '{$2++; $3=0; print}')
|
||||
elif [ "$VERSION_TYPE" == "major" ]; then
|
||||
new_version=$(echo $current_version | awk -F. -v OFS=. '{$1++; $2=0; $3=0; print}')
|
||||
fi
|
||||
|
||||
# Output the new version
|
||||
echo "$new_version"
|
||||
Reference in New Issue
Block a user