mirror of
https://github.com/ReVanced/revanced-bots.git
synced 2026-01-11 13:56:15 +00:00
80 lines
2.3 KiB
YAML
80 lines
2.3 KiB
YAML
name: Release
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- main
|
|
- dev
|
|
|
|
jobs:
|
|
release:
|
|
name: Release
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
# Make sure the release step uses its own credentials:
|
|
# https://github.com/cycjimmy/semantic-release-action#private-packages
|
|
persist-credentials: false
|
|
fetch-depth: 0
|
|
|
|
- name: Cache dependencies
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: '**/node_modules'
|
|
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }}
|
|
restore-keys: ${{ runner.os }}-bun-
|
|
|
|
- name: Setup Bun
|
|
uses: oven-sh/setup-bun@v2
|
|
|
|
- name: Install dependencies
|
|
run: bun install --frozen-lockfile
|
|
|
|
- name: Build packages
|
|
run: bun run build:packages
|
|
|
|
- name: Setup QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
with:
|
|
platforms: amd64, arm64
|
|
|
|
- name: Setup Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Build and release
|
|
env:
|
|
DOCKER_REGISTRY_USER: ${{ github.actor }}
|
|
DOCKER_REGISTRY_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
|
|
GITHUB_ACTOR: ${{ github.actor }}
|
|
GITHUB_TOKEN: ${{ secrets.REPOSITORY_PUSH_ACCESS }}
|
|
run: bunx multi-semantic-release
|
|
|
|
- name: Set Portainer stack webhook URL based on branch
|
|
run: |
|
|
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
|
|
PORTAINER_WEBHOOK_URL=${{ secrets.PORTAINER_WEBHOOK_MAIN_URL }}
|
|
else
|
|
PORTAINER_WEBHOOK_URL=${{ secrets.PORTAINER_WEBHOOK_DEV_URL }}
|
|
fi
|
|
echo "PORTAINER_WEBHOOK_URL=$PORTAINER_WEBHOOK_URL" >> $GITHUB_ENV
|
|
|
|
- name: Trigger Portainer stack update
|
|
uses: newarifrh/portainer-service-webhook@v1
|
|
with:
|
|
webhook_url: ${{ env.PORTAINER_WEBHOOK_URL }}
|
|
|
|
- name: Purge outdated images
|
|
uses: snok/container-retention-policy@v3.0.0
|
|
with:
|
|
account: ${{ github.actor }}
|
|
token: ${{ secrets.REPOSITORY_PUSH_ACCESS }}
|
|
image-names: "revanced-bot-*"
|
|
keep-n-most-recent: 5
|
|
cut-off: 3M
|