-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4f74997
commit 1f17b36
Showing
6 changed files
with
1,002 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
version: 2 | ||
updates: | ||
|
||
# Maintain dependencies for GitHub Actions | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "monthly" | ||
assignees: | ||
- "kerberizer" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
--- | ||
name: CI | ||
|
||
on: # yamllint disable-line rule:truthy | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
tags: | ||
- v*.*.* | ||
workflow_dispatch: | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
# IMAGE_NAME: ${{ github.repository }} | ||
IMAGE_NAME: h2020charisma/spectrasearch | ||
|
||
jobs: | ||
|
||
build: | ||
|
||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
# This is used to complete the identity challenge | ||
# with sigstore/fulcio when running outside of PRs. | ||
id-token: write | ||
|
||
steps: | ||
|
||
- name: Get current time for further reference | ||
run: echo "NOW='$(date --rfc-3339=seconds --utc)'" >>$GITHUB_ENV | ||
|
||
- name: Checkout repository | ||
uses: actions/[email protected] | ||
|
||
# Install the cosign tool except on PR | ||
# https://github.com/sigstore/cosign-installer | ||
- name: Install cosign | ||
if: github.event_name != 'pull_request' | ||
uses: sigstore/[email protected] | ||
with: | ||
cosign-release: 'v2.2.4' | ||
|
||
# Workaround: https://github.com/docker/build-push-action/issues/461 | ||
- name: Setup Docker buildx | ||
uses: docker/[email protected] | ||
|
||
# Login against a Docker registry except on PR | ||
# https://github.com/docker/login-action | ||
- name: Log into registry ${{ env.REGISTRY }} | ||
if: github.event_name != 'pull_request' | ||
uses: docker/[email protected] | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# Extract metadata (tags, labels) for Docker | ||
# https://github.com/docker/metadata-action | ||
- name: Extract Docker metadata | ||
id: meta | ||
uses: docker/[email protected] | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
labels: | | ||
org.opencontainers.image.description=Spectra Search Interface | ||
org.opencontainers.image.licenses=MIT | ||
org.opencontainers.image.source=https://github.com/h2020charisma/spectrasearch | ||
org.opencontainers.image.title=spectra-search | ||
org.opencontainers.image.url=https://github.com/h2020charisma/spectrasearch/blob/main/README.md | ||
org.opencontainers.image.vendor=IDEAconsult | ||
tags: | | ||
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/develop' }} | ||
type=raw,value=stable,enable=${{ github.ref == 'refs/heads/main' }} | ||
type=ref,event=branch | ||
type=ref,event=tag | ||
type=ref,event=pr | ||
# Build and push Docker image with Buildx (don't push on PR) | ||
# https://github.com/docker/build-push-action | ||
- name: Build and push Docker image | ||
id: build-and-push | ||
uses: docker/[email protected] | ||
with: | ||
build-args: | | ||
BUILD_DATE=${{ env.NOW }} | ||
VCS_REF=${{ github.sha }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
context: . | ||
labels: ${{ steps.meta.outputs.labels }} | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
|
||
# Sign the resulting Docker image digest except on PRs. | ||
# This will only write to the public Rekor transparency log when the Docker | ||
# repository is public to avoid leaking data. If you would like to publish | ||
# transparency data even for private images, pass --force to cosign below. | ||
# https://github.com/sigstore/cosign | ||
- name: Sign the published Docker image | ||
if: github.event_name != 'pull_request' | ||
env: | ||
# https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable | ||
TAGS: ${{ steps.meta.outputs.tags }} | ||
DIGEST: ${{ steps.build-and-push.outputs.digest }} | ||
# This step uses the identity token to provision an ephemeral certificate | ||
# against the sigstore community Fulcio instance. | ||
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
extends: default | ||
rules: | ||
line-length: | ||
max: 119 | ||
new-lines: | ||
type: platform |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
FROM node:lts-alpine AS requirements-stage | ||
|
||
WORKDIR /tmp | ||
|
||
COPY \ | ||
./.eslintrc.cjs \ | ||
./index.html \ | ||
./package*.json \ | ||
./vite.config.js \ | ||
/tmp | ||
COPY ./components /tmp/components | ||
COPY ./data /tmp/data | ||
COPY ./public /tmp/public | ||
COPY ./src /tmp/src | ||
|
||
RUN npm install | ||
RUN npm run build-docker | ||
|
||
FROM nginx:mainline | ||
|
||
COPY --from=requirements-stage /tmp/dist /usr/share/nginx/html |
Oops, something went wrong.