|
1 | 1 | --- |
2 | 2 | name: CI |
| 3 | + |
3 | 4 | on: |
4 | 5 | push: |
5 | 6 | branches: |
6 | 7 | - master |
| 8 | + tags: |
| 9 | + - "*" |
7 | 10 | pull_request: |
8 | 11 | branches: |
9 | 12 | - master |
10 | 13 | workflow_dispatch: |
| 14 | + inputs: |
| 15 | + use_cache: |
| 16 | + description: "Use build cache" |
| 17 | + required: true |
| 18 | + type: boolean |
| 19 | + default: true |
| 20 | + |
| 21 | +env: |
| 22 | + REGISTRY: ghcr.io |
| 23 | + IMAGE_NAME: ${{ github.repository }} |
| 24 | + |
11 | 25 | jobs: |
12 | 26 | build: |
13 | 27 | runs-on: ubuntu-latest |
|
72 | 86 | run: pnpm lhci autorun |
73 | 87 | env: |
74 | 88 | LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }} |
| 89 | + |
| 90 | + docker: |
| 91 | + runs-on: ubuntu-latest |
| 92 | + needs: build |
| 93 | + permissions: |
| 94 | + contents: read |
| 95 | + packages: write |
| 96 | + id-token: write |
| 97 | + attestations: write |
| 98 | + steps: |
| 99 | + - name: Checkout repository |
| 100 | + uses: actions/checkout@v5 |
| 101 | + |
| 102 | + - name: Set up QEMU |
| 103 | + uses: docker/setup-qemu-action@v3 |
| 104 | + with: |
| 105 | + platforms: all |
| 106 | + |
| 107 | + - name: Setup Docker buildx |
| 108 | + uses: docker/setup-buildx-action@v3 |
| 109 | + |
| 110 | + # Login against a Docker registry except on PR |
| 111 | + # https://github.com/docker/login-action |
| 112 | + - name: Log into registry ${{ env.REGISTRY }} |
| 113 | + if: github.event_name != 'pull_request' |
| 114 | + uses: docker/login-action@v3.4.0 |
| 115 | + with: |
| 116 | + registry: ${{ env.REGISTRY }} |
| 117 | + username: ${{ github.actor }} |
| 118 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 119 | + |
| 120 | + - name: Extract Docker metadata |
| 121 | + id: meta |
| 122 | + uses: docker/metadata-action@v5 |
| 123 | + with: |
| 124 | + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} |
| 125 | + labels: | |
| 126 | + org.opencontainers.image.title=Fluorite |
| 127 | + org.opencontainers.image.description=An elegant PWA video player |
| 128 | + org.opencontainers.image.authors=AFCMS <afcm.contact@gmail.com> |
| 129 | + org.opencontainers.image.licenses=GPL-3.0-only |
| 130 | + org.opencontainers.image.source=https://github.com/AFCMS/fluorite |
| 131 | + io.artifacthub.package.logo-url=https://raw.githubusercontent.com/AFCMS/fluorite/refs/heads/master/public/fluorite.svg |
| 132 | + io.artifacthub.package.readme-url=https://raw.githubusercontent.com/AFCMS/fluorite/refs/heads/master/README.md |
| 133 | + io.artifacthub.package.category=skip-prediction |
| 134 | + io.artifacthub.package.keywords=video-player,offline,pwa |
| 135 | + io.artifacthub.package.license=GPL-3.0-only |
| 136 | + io.artifacthub.package.maintainers=[{"name":"AFCMS","email":"afcm.contact@gmail.com"}] |
| 137 | + annotations: | |
| 138 | + org.opencontainers.image.title=Fluorite |
| 139 | + org.opencontainers.image.description=An elegant PWA video player |
| 140 | + org.opencontainers.image.authors=AFCMS <afcm.contact@gmail.com> |
| 141 | + org.opencontainers.image.licenses=GPL-3.0-only |
| 142 | + org.opencontainers.image.source=https://github.com/AFCMS/fluorite |
| 143 | + io.artifacthub.package.logo-url=https://raw.githubusercontent.com/AFCMS/fluorite/refs/heads/master/public/fluorite.svg |
| 144 | + io.artifacthub.package.readme-url=https://raw.githubusercontent.com/AFCMS/fluorite/refs/heads/master/README.md |
| 145 | + io.artifacthub.package.category=skip-prediction |
| 146 | + io.artifacthub.package.keywords=video-player,offline,pwa |
| 147 | + io.artifacthub.package.license=GPL-3.0-only |
| 148 | + io.artifacthub.package.maintainers=[{"name":"AFCMS","email":"afcm.contact@gmail.com"}] |
| 149 | +
|
| 150 | + # Build and push Docker image with Buildx (don't push on PR) |
| 151 | + # https://github.com/docker/build-push-action |
| 152 | + - name: Build and push Docker image |
| 153 | + id: build-and-push |
| 154 | + uses: docker/build-push-action@v6 |
| 155 | + with: |
| 156 | + context: . |
| 157 | + file: Dockerfile |
| 158 | + platforms: linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7,linux/ppc64le,linux/riscv64,linux/s390x |
| 159 | + push: ${{ github.event_name != 'pull_request' }} |
| 160 | + tags: ${{ steps.meta.outputs.tags }} |
| 161 | + labels: ${{ steps.meta.outputs.labels }} |
| 162 | + cache-from: type=gha |
| 163 | + cache-to: type=gha,mode=max |
| 164 | + no-cache: ${{ (github.event_name == 'workflow_dispatch' && !inputs.use_cache) || startsWith(github.ref, 'refs/tags/') }} |
| 165 | + |
| 166 | + - name: Attest Build Provenance |
| 167 | + if: github.event_name != 'pull_request' |
| 168 | + uses: actions/attest-build-provenance@v3 |
| 169 | + with: |
| 170 | + subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} |
| 171 | + subject-digest: ${{ steps.build-and-push.outputs.digest }} |
| 172 | + push-to-registry: false |
0 commit comments