From a70631d2ae9ffb3e3136b39b28e5d152dd744655 Mon Sep 17 00:00:00 2001 From: David Date: Fri, 18 Aug 2023 20:05:46 +0000 Subject: [PATCH] =?UTF-8?q?ci=F0=9F=91=B7=E2=80=8D=E2=99=82=EF=B8=8F:=20bu?= =?UTF-8?q?ild=20and=20publish=20two=20latex=20images?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/docker-publish.yml | 76 ++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 .github/workflows/docker-publish.yml diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml new file mode 100644 index 0000000..13f8247 --- /dev/null +++ b/.github/workflows/docker-publish.yml @@ -0,0 +1,76 @@ +name: Publicar imagen Docker (LaTeX) + +on: + schedule: + - cron: '0 20 1 * *' + workflow_dispatch: + push: + paths: + - latex/** + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + id-token: write + + strategy: + matrix: + dockerfile: [latex/full/Dockerfile, latex/min/Dockerfile] + include: + - dockerfile: latex/full/Dockerfile + tag_suffix: full + - dockerfile: latex/min/Dockerfile + tag_suffix: min + + steps: + - name: Revisar repositorio + uses: actions/checkout@v3 + + - name: Instalar cosign + if: github.event_name != 'pull_request' + uses: sigstore/cosign-installer@v3.1.1 + with: + cosign-release: 'v2.1.1' + + - name: Configurar Docker buildx + uses: docker/setup-buildx-action@v1 + + - name: Iniciar sesiĆ³n en el registro ${{ env.REGISTRY }} + if: github.event_name != 'pull_request' + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extraer metadatos de Docker + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-${{ matrix.tag_suffix }} + + - name: Construir y publicar imagen Docker + id: build-and-push + uses: docker/build-push-action@v2 + with: + context: . + file: ${{ matrix.dockerfile }} + 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 + + - name: Firmar la imagen Docker publicada + if: ${{ github.event_name != 'pull_request' }} + env: + TAGS: ${{ steps.meta.outputs.tags }} + DIGEST: ${{ steps.build-and-push.outputs.digest }} + run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST} \ No newline at end of file