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: # 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