Skip to content

Revert "reduce for test" #198

Revert "reduce for test"

Revert "reduce for test" #198

Workflow file for this run

name: Release
on:
push:
branches:
- main
- beta
- betatest
jobs:
build-test-release:
runs-on: [gpu]
steps:
- name: Define environment variables
run: echo IMAGE_NAME=ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Important for Semantic Release to analyze all commits
- name: Copy external assets
run: cp /home/runner/NVIDIA-OptiX-SDK-7.6.0-linux64-x86_64.sh .
- name: Set up docker buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build image locally
uses: docker/build-push-action@v5
with:
context: .
tags: ${{ env.IMAGE_NAME }}:latest
pull: true
load: true
cache-from: ${{ env.IMAGE_NAME }}:latest
cache-to: type=inline
- name: Test esi-shell
run: ./esi-shell "opticks-full-prepare && opticks-t"
- name: Declare latest and push
run: docker push ${{ env.IMAGE_NAME }}:latest
- name: Create semantic release
uses: cycjimmy/semantic-release-action@v4
id: semantic
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout new release
if: steps.semantic.outputs.new_release_published == 'true'
uses: actions/checkout@v4
with:
ref: ${{ steps.semantic.outputs.new_release_git_tag }}
- name: Copy external assets
run: cp /home/runner/NVIDIA-OptiX-SDK-7.6.0-linux64-x86_64.sh .
- name: Build image for new release
if: steps.semantic.outputs.new_release_published == 'true'
uses: docker/build-push-action@v5
with:
context: .
tags: |
${{ env.IMAGE_NAME }}:latest
${{ env.IMAGE_NAME }}:${{ steps.semantic.outputs.new_release_version }}
push: true
provenance: false
cache-from: ${{ env.IMAGE_NAME }}:latest
cache-to: type=inline
deploy:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build-test-release
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- run: |
SEMVER=$(grep -Po '"version": "\K[^"]*' package.json)
sed -i "s/ESI_SHELL_VERSION=.*/ESI_SHELL_VERSION=${SEMVER}-$(git rev-parse --short HEAD)/g" esi-shell
- run: grep ESI_SHELL_VERSION esi-shell
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Build with Jekyll
uses: actions/jekyll-build-pages@v1
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
cleanup:
runs-on: ubuntu-latest
needs: build-test-release
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Delete untagged images
run: |
python -m pip install requests
.github/workflows/delete_untagged.py ${{ secrets.BNLNPPS_ESI_SHELL_PACKAGES_TOKEN }}