Fixed the race condition issue on form fields(fix #64) (#68) #35
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
# Copyright 2024 Google LLC | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
name: Build and Deploy | |
on: | |
push: | |
branches: | |
- main | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: 'read' | |
id-token: 'write' | |
packages: 'write' | |
attestations: write | |
steps: | |
- name: Log in to the Container registry | |
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # 3.3.0 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #4.4.2 | |
- name: Set up Node.js | |
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af #4.1.0 | |
with: | |
node-version-file: './.node-version' | |
- name: Set up Go | |
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 #5.3.0 | |
with: | |
go-version-file: './go.mod' | |
- name: Get Version from VERSION file | |
id: get_version | |
run: echo "VERSION=$(cat VERSION)" >> $GITHUB_OUTPUT | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96 #5.6.1 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: | | |
type=raw,value=latest | |
type=raw,value=${{ steps.get_version.outputs.VERSION }} | |
type=semver,pattern={{version}},value=${{ steps.get_version.outputs.VERSION }} | |
labels: | | |
org.opencontainers.image.title=Kubernetes History Inspector | |
org.opencontainers.image.description=An interactive log visualizer for Kubernetes | |
org.opencontainers.image.version=${{ steps.get_version.outputs.VERSION }} | |
- name: npm install | |
working-directory: ./web | |
run: npm ci | |
- name: Generate frontend codes | |
run: | | |
sudo apt-get update && sudo apt-get install jq -y | |
make prepare-frontend | |
- name: Build web | |
run: make build-web | |
- name: Build and push Docker image | |
id: push | |
uses: docker/build-push-action@ca877d9245402d1537745e0e356eab47c3520991 #6.13.0 | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
- name: Generate artifact attestation | |
uses: actions/attest-build-provenance@520d128f165991a6c774bcb264f323e3d70747f4 #2.2.0 | |
with: | |
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} | |
subject-digest: ${{ steps.push.outputs.digest }} | |
push-to-registry: true |