140 lines
4.0 KiB
YAML
Vendored
140 lines
4.0 KiB
YAML
Vendored
name: Release & Publish
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "V*"
|
|
workflow_dispatch:
|
|
inputs:
|
|
release_apps:
|
|
description: "Build popular apps"
|
|
type: boolean
|
|
default: false
|
|
publish_docker:
|
|
description: "Publish Docker image"
|
|
type: boolean
|
|
default: false
|
|
|
|
env:
|
|
REGISTRY: ghcr.io
|
|
IMAGE_NAME: ${{ github.repository }}
|
|
|
|
jobs:
|
|
# Update contributor list
|
|
update-contributors:
|
|
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
pull-requests: write
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
fetch-depth: 0
|
|
|
|
- name: Update Contributors in README.md
|
|
uses: akhilmhdh/contributors-readme-action@v2.3.6
|
|
with:
|
|
image_size: 90
|
|
columns_per_row: 7
|
|
auto_detect_branch_protection: false
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Update Contributors in README_CN.md
|
|
uses: akhilmhdh/contributors-readme-action@v2.3.6
|
|
with:
|
|
image_size: 90
|
|
columns_per_row: 7
|
|
readme_path: README_CN.md
|
|
auto_detect_branch_protection: false
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Update Contributors in README_JP.md
|
|
uses: akhilmhdh/contributors-readme-action@v2.3.6
|
|
with:
|
|
image_size: 90
|
|
columns_per_row: 7
|
|
readme_path: README_JP.md
|
|
auto_detect_branch_protection: false
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
# Build and release popular apps
|
|
release-apps:
|
|
if: |
|
|
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) ||
|
|
(github.event_name == 'workflow_dispatch' && inputs.release_apps)
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
apps_name: ${{ steps.read-apps-config.outputs.apps_name }}
|
|
apps_config: ${{ steps.read-apps-config.outputs.apps_config }}
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Get Apps Config
|
|
id: read-apps-config
|
|
run: |
|
|
echo "apps_name=$(jq -c '[.[] | .name]' default_app_list.json)" >> $GITHUB_OUTPUT
|
|
echo "apps_config=$(jq -c '.' default_app_list.json)" >> $GITHUB_OUTPUT
|
|
|
|
build-popular-apps:
|
|
needs: release-apps
|
|
if: needs.release-apps.result == 'success'
|
|
strategy:
|
|
matrix:
|
|
config: ${{ fromJSON(needs.release-apps.outputs.apps_config) }}
|
|
uses: ./.github/workflows/single-app.yaml
|
|
with:
|
|
name: ${{ matrix.config.name }}
|
|
title: ${{ matrix.config.title }}
|
|
name_zh: ${{ matrix.config.name_zh }}
|
|
url: ${{ matrix.config.url }}
|
|
|
|
# Publish Docker image (runs in parallel with app builds)
|
|
publish-docker:
|
|
if: |
|
|
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) ||
|
|
(github.event_name == 'workflow_dispatch' && inputs.publish_docker)
|
|
runs-on: ubuntu-22.04
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Log in to Container registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Extract metadata
|
|
id: meta
|
|
uses: docker/metadata-action@v4
|
|
with:
|
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
tags: |
|
|
type=raw,value=latest,enable={{is_default_branch}}
|
|
type=ref,event=tag
|
|
type=sha
|
|
|
|
- name: Build and push Docker image
|
|
uses: docker/build-push-action@v4
|
|
with:
|
|
context: .
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
no-cache: true
|
|
platforms: linux/amd64
|