Forward slash #13
Workflow file for this run
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
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs | |
name: Release | |
on: | |
push: | |
tags: [ "*" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
attestations: write | |
id-token: write | |
strategy: | |
matrix: | |
node-version: [20.x] | |
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/ | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'npm' | |
- name: Build UI | |
run: | | |
sed -i 's#<meta name="version" content="" />#<meta name="version" content="'$GITHUB_REF_NAME'@'$GITHUB_SHA'" />#' index.html | |
sed -i 's#<span>0.0.0</span>#<span>$GITHUB_REF_NAME</span>#' src/Version.tsx | |
sed -i 's# "version": "[0-9].[0-9].[0-9]",# "version": "'"$GITHUB_REF_NAME"'",#' package.json | |
grep version index.html | |
npm ci | |
npx tsc --noEmit | |
npm run build --if-present | |
tar -czf build.tar.gz dist | |
- name: Build server | |
run: | | |
cd server | |
sed -i 's# "version": "[0-9].[0-9].[0-9]",# "version": "'"$GITHUB_REF_NAME"'",#' package.json | |
npm ci | |
npx tsc --noEmit | |
- name: Create SBOMs | |
run: | | |
npx @cyclonedx/cyclonedx-npm --output-file swarmview-ui.sbom.json | |
cd server | |
npx @cyclonedx/cyclonedx-npm --output-file ../swarmview-server.sbom.json | |
cd .. | |
docker run -v .:/files cyclonedx/cyclonedx-cli merge --input-files /files/swarmview-server.sbom.json /files/swarmview-ui.sbom.json --output-file /files/swarmview.sbom.json | |
- name: Build image | |
run: | | |
docker build -t ${GITHUB_REPOSITORY#*/}:${GITHUB_REF_NAME} . | |
- name: Generate SBOMs | |
run: | | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Deploy container image | |
run: | | |
echo ${GITHUB_REPOSITORY#*/} | |
docker image ls | head | |
IFS=' ' read -ra PARTS <<< `docker image ls | grep ${GITHUB_REPOSITORY#*/} | grep -v ghcr` && \ | |
echo $PARTS | |
docker tag ${PARTS[2]} ghcr.io/yaytay/${PARTS[0]}:${PARTS[1]} && \ | |
docker push ghcr.io/yaytay/${PARTS[0]}:${PARTS[1]} | |
#- name: asciidoctor-ghpages | |
# uses: manoelcampos/asciidoctor-ghpages-action@v2 | |
# with: | |
# pdf_build: false | |
# # asciidoctor_params: --attribute=nofooter | |
# # adoc_file_ext: .ascii # default is .adoc | |
# source_dir: docs/ | |
# # slides_build: true | |
# # pre_build: | |
# # post_build: |