Merge pull request #317 from TriliumNext/remove-ci-cd-matrices

Remove the strategy matrix for concurrent builds.
This commit is contained in:
Elian Doran 2024-08-09 09:22:02 +03:00 committed by GitHub
commit d0042b5891
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -16,140 +16,137 @@ env:
DOCKERHUB_REGISTRY: docker.io DOCKERHUB_REGISTRY: docker.io
IMAGE_NAME: ${{ github.repository }} IMAGE_NAME: ${{ github.repository }}
TEST_TAG: triliumnext/notes:test TEST_TAG: triliumnext/notes:test
PLATFORMS: linux/amd64,linux/arm64,linux/arm/v7,linux/arm64/v8 PLATFORMS: linux/amd64,linux/arm64,linux/arm/v7
jobs: jobs:
test_docker: test_docker:
name: Check Docker build name: Check Docker build
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout the repository - name: Checkout the repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3
- name: Set up node & dependencies - name: Set up node & dependencies
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: 20 node-version: 20
cache: "npm" cache: "npm"
- run: npm ci - run: npm ci
- name: Run the TypeScript build - name: Run the TypeScript build
run: npx tsc run: npx tsc
- name: Create server-package.json - name: Create server-package.json
run: cat package.json | grep -v electron > server-package.json run: cat package.json | grep -v electron > server-package.json
- name: Build and export to Docker - name: Build and export to Docker
uses: docker/build-push-action@v6 uses: docker/build-push-action@v6
with: with:
context: . context: .
load: true load: true
tags: ${{ env.TEST_TAG }} tags: ${{ env.TEST_TAG }}
cache-from: type=gha cache-from: type=gha
cache-to: type=gha,mode=max cache-to: type=gha,mode=max
- name: Run the container in the background - name: Run the container in the background
run: docker run -d --rm --name trilium_local ${{ env.TEST_TAG }} run: docker run -d --rm --name trilium_local ${{ env.TEST_TAG }}
- name: Wait for the healthchecks to pass - name: Wait for the healthchecks to pass
uses: stringbean/docker-healthcheck-action@v1 uses: stringbean/docker-healthcheck-action@v1
with: with:
container: trilium_local container: trilium_local
wait-time: 50 wait-time: 50
require-status: running require-status: running
require-healthy: true require-healthy: true
build_docker: build_docker:
name: Build Docker images name: Build Docker images
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: needs:
- test_docker - test_docker
permissions: permissions:
contents: read contents: read
packages: write packages: write
attestations: write attestations: write
id-token: write id-token: write
strategy: steps:
matrix: - uses: actions/checkout@v4
architecture: [linux/amd64, linux/arm64, linux/arm/v7, linux/arm64/v8] - name: Extract metadata (tags, labels) for GHCR image
steps: id: ghcr-meta
- uses: actions/checkout@v4 uses: docker/metadata-action@v4
- name: Extract metadata (tags, labels) for GHCR image with:
id: ghcr-meta images: ${{ env.GHCR_REGISTRY }}/${{ env.IMAGE_NAME }}
uses: docker/metadata-action@v4 tags: |
with: type=ref,event=branch
images: ${{ env.GHCR_REGISTRY }}/${{ env.IMAGE_NAME }} type=ref,event=tag
tags: | type=sha
type=ref,event=branch - name: Extract metadata (tags, labels) for DockerHub image
type=ref,event=tag id: dh-meta
type=sha uses: docker/metadata-action@v4
- name: Extract metadata (tags, labels) for DockerHub image with:
id: dh-meta images: ${{ env.DOCKERHUB_REGISTRY }}/${{ env.IMAGE_NAME }}
uses: docker/metadata-action@v4 tags: |
with: type=ref,event=branch
images: ${{ env.DOCKERHUB_REGISTRY }}/${{ env.IMAGE_NAME }} type=ref,event=tag
tags: | type=sha
type=ref,event=branch - name: Set up node & dependencies
type=ref,event=tag uses: actions/setup-node@v4
type=sha with:
- name: Set up node & dependencies node-version: 20
uses: actions/setup-node@v4 cache: "npm"
with: - run: npm ci
node-version: 20 - name: Run the TypeScript build
cache: "npm" run: npx tsc
- run: npm ci - name: Create server-package.json
- name: Run the TypeScript build run: cat package.json | grep -v electron > server-package.json
run: npx tsc - name: Log in to the GHCR container registry
- name: Create server-package.json uses: docker/login-action@v2
run: cat package.json | grep -v electron > server-package.json with:
- name: Log in to the GHCR container registry registry: ${{ env.GHCR_REGISTRY }}
uses: docker/login-action@v2 username: ${{ github.actor }}
with: password: ${{ secrets.GITHUB_TOKEN }}
registry: ${{ env.GHCR_REGISTRY }} - uses: docker/setup-buildx-action@v3
username: ${{ github.actor }} - name: Build and push container image to GHCR
password: ${{ secrets.GITHUB_TOKEN }} uses: docker/build-push-action@v6
- uses: docker/setup-buildx-action@v3 id: ghcr-push
- name: Build and push container image to GHCR with:
uses: docker/build-push-action@v6 context: .
id: ghcr-push platforms: ${{ env.PLATFORMS }}
with: push: true
context: . tags: ${{ steps.ghcr-meta.outputs.tags }}
platforms: ${{ matrix.architecture }} labels: ${{ steps.ghcr-meta.outputs.labels }}
push: true cache-from: type=gha
tags: ${{ steps.ghcr-meta.outputs.tags }} cache-to: type=gha,mode=max
labels: ${{ steps.ghcr-meta.outputs.labels }} - name: Generate and push artifact attestation to GHCR
cache-from: type=gha uses: actions/attest-build-provenance@v1
cache-to: type=gha,mode=max with:
- name: Generate and push artifact attestation to GHCR subject-name: ${{ env.GHCR_REGISTRY }}/${{ env.IMAGE_NAME}}
uses: actions/attest-build-provenance@v1 subject-digest: ${{ steps.ghcr-push.outputs.digest }}
with: push-to-registry: true
subject-name: ${{ env.GHCR_REGISTRY }}/${{ env.IMAGE_NAME}} - name: Log in to the DockerHub container registry
subject-digest: ${{ steps.ghcr-push.outputs.digest }} uses: docker/login-action@v2
push-to-registry: true with:
- name: Log in to the DockerHub container registry registry: ${{ env.DOCKERHUB_REGISTRY }}
uses: docker/login-action@v2 username: ${{ secrets.DOCKERHUB_USERNAME }}
with: password: ${{ secrets.DOCKERHUB_TOKEN }}
registry: ${{ env.DOCKERHUB_REGISTRY }} - name: Build and push image to DockerHub
username: ${{ secrets.DOCKERHUB_USERNAME }} uses: docker/build-push-action@v6
password: ${{ secrets.DOCKERHUB_TOKEN }} id: dh-push
- name: Build and push image to DockerHub with:
uses: docker/build-push-action@v6 context: .
id: dh-push platforms: ${{ env.PLATFORMS }}
with: push: true
context: . tags: ${{ steps.dh-meta.outputs.tags }}
platforms: ${{ matrix.architecture }} labels: ${{ steps.dh-meta.outputs.labels }}
push: true cache-from: type=gha
tags: ${{ steps.dh-meta.outputs.tags }} cache-to: type=gha,mode=max
labels: ${{ steps.dh-meta.outputs.labels }} - name: Generate and push artifact attestation to DockerHub
cache-from: type=gha uses: actions/attest-build-provenance@v1
cache-to: type=gha,mode=max with:
- name: Generate and push artifact attestation to DockerHub subject-name: ${{ env.DOCKERHUB_REGISTRY }}/${{ env.IMAGE_NAME}}
uses: actions/attest-build-provenance@v1 subject-digest: ${{ steps.dh-push.outputs.digest }}
with: push-to-registry: true
subject-name: ${{ env.DOCKERHUB_REGISTRY }}/${{ env.IMAGE_NAME}}
subject-digest: ${{ steps.dh-push.outputs.digest }}
push-to-registry: true