mirror of
https://github.com/rangermix/TwitchDropsMiner.git
synced 2026-06-02 10:29:37 +00:00
- Comment out push and pull_request triggers - Keep workflow_dispatch for manual runs only - Prevents automatic builds on every push 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
148 lines
4.2 KiB
YAML
148 lines
4.2 KiB
YAML
name: Build
|
|
|
|
on:
|
|
# Disabled automatic builds - run manually only
|
|
# push:
|
|
# branches:
|
|
# - "master"
|
|
# pull_request:
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
PYTHON_VERSION: "3.10"
|
|
USE_UPX: false
|
|
|
|
jobs:
|
|
validate:
|
|
name: Validate
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: ${{env.PYTHON_VERSION}}
|
|
|
|
- name: Validate language files
|
|
run: |
|
|
failed=()
|
|
for file in "lang/"*.json; do
|
|
if err="$(python -m json.tool "${file}" 2>&1 >/dev/null)"; then
|
|
echo "[OK] ${file}"
|
|
else
|
|
echo "[ERROR] ${file} ${err}"
|
|
failed+=("${file}")
|
|
fi
|
|
done
|
|
if [ "${#failed[@]}" -gt 0 ]; then
|
|
echo -e "\nFailed to validate the following language file(s): ${failed[@]}"
|
|
exit 1
|
|
fi
|
|
docker:
|
|
name: Docker Build
|
|
runs-on: ubuntu-latest
|
|
needs:
|
|
- validate
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up variables
|
|
id: vars
|
|
run: |
|
|
echo "sha_short=$(git rev-parse --short HEAD)" >> "${GITHUB_OUTPUT}"
|
|
echo "date=$(date +%Y-%m-%d)" >> "${GITHUB_OUTPUT}"
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Login to GitHub Container Registry
|
|
if: github.event_name != 'pull_request'
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{github.actor}}
|
|
password: ${{secrets.GITHUB_TOKEN}}
|
|
|
|
- name: Extract metadata for Docker
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ghcr.io/${{github.repository}}
|
|
tags: |
|
|
type=raw,value=dev
|
|
type=raw,value=dev-${{steps.vars.outputs.sha_short}}
|
|
type=raw,value=latest,enable=${{github.ref == 'refs/heads/master'}}
|
|
type=sha,prefix=
|
|
|
|
- name: Build and push Docker image
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
platforms: linux/amd64,linux/arm64
|
|
push: ${{github.event_name != 'pull_request'}}
|
|
tags: ${{steps.meta.outputs.tags}}
|
|
labels: ${{steps.meta.outputs.labels}}
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|
|
build-args: |
|
|
BUILD_DATE=${{steps.vars.outputs.date}}
|
|
VCS_REF=${{github.sha}}
|
|
VERSION=dev-${{steps.vars.outputs.sha_short}}
|
|
|
|
update_releases_page:
|
|
name: Upload builds to Releases
|
|
if: github.event_name != 'pull_request'
|
|
needs:
|
|
- docker
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
|
|
steps:
|
|
- name: Set up variables
|
|
id: vars
|
|
run: |
|
|
echo "date_now=$(date --rfc-3339=seconds)" >> "${GITHUB_OUTPUT}"
|
|
|
|
- name: Download build artifacts from previous jobs
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
path: artifacts
|
|
|
|
- name: Delete the existing pre-release (if present)
|
|
run: |
|
|
TAG=dev-build
|
|
if gh release view "$TAG" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
|
|
gh release delete "$TAG" --cleanup-tag --yes --repo "$GITHUB_REPOSITORY"
|
|
else
|
|
echo "No $TAG release; skipping delete"
|
|
fi
|
|
env:
|
|
GITHUB_TOKEN: ${{github.token}}
|
|
|
|
- name: Create a new dev build release
|
|
uses: ncipollo/release-action@v1
|
|
with:
|
|
allowUpdates: true
|
|
artifactErrorsFailBuild: true
|
|
artifacts: artifacts/*/*
|
|
body: |
|
|
**This is an automatically generated in-development pre-release version of the application, that includes the latest master branch changes.**
|
|
**⚠️ This build is not stable and may end up terminating with a fatal error. ⚠️**
|
|
**Use at your own risk.**
|
|
|
|
- Last build date: `${{steps.vars.outputs.date_now}}`
|
|
- Reference commit: ${{github.sha}}
|
|
name: Development build
|
|
prerelease: true
|
|
removeArtifacts: true
|
|
tag: dev-build
|