diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..25e8234 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,60 @@ +name: Release + +on: + push: + branches: + - semrel + +jobs: + build-test-release: + runs-on: ubuntu-latest + 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: Set up Docker buildx + uses: docker/setup-buildx-action@v3 + + - name: Build container + uses: docker/build-push-action@v5 + with: + file: Dockerfile.test + tags: ${{ env.IMAGE_NAME }}:pre-semver + load: true + cache-from: ${{ env.IMAGE_NAME }}:latest + + - name: Run tests + run: docker run ${{ env.IMAGE_NAME }}:pre-semver curl --version + + - name: Semantic release + uses: cycjimmy/semantic-release-action@v4 + id: semantic + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: ${{ steps.semantic.outputs.new_release_git_tag }} + + - name: Login to GitHub container registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build container + uses: docker/build-push-action@v5 + with: + file: Dockerfile.test + tags: | + ${{ env.IMAGE_NAME }}:latest + ${{ env.IMAGE_NAME }}:${{ steps.semantic.outputs.new_release_version }} + push: true + cache-from: ${{ env.IMAGE_NAME }}:pre-semver diff --git a/.releaserc.yaml b/.releaserc.yaml new file mode 100644 index 0000000..5be77ac --- /dev/null +++ b/.releaserc.yaml @@ -0,0 +1,15 @@ +# See https://semantic-release.gitbook.io/semantic-release/usage/configuration +branches: + - semrel +tagFormat: '${version}' # without this, the tag is prefixed with a 'v' +plugins: + - "@semantic-release/commit-analyzer" + - "@semantic-release/release-notes-generator" + - "@semantic-release/changelog" + - path: "@semantic-release/npm" + npmPublish: false + - path: "@semantic-release/git" + assets: + - "CHANGELOG.md" + - "package.json" + message: "chore(release): ${nextRelease.version}\n\n${nextRelease.notes}" diff --git a/Dockerfile.test b/Dockerfile.test new file mode 100644 index 0000000..e34109b --- /dev/null +++ b/Dockerfile.test @@ -0,0 +1,7 @@ +# syntax=docker/dockerfile:latest + +FROM nvcr.io/nvidia/cuda:11.8.0-runtime-ubuntu22.04 + +ARG DEBIAN_FRONTEND=noninteractive + +RUN apt update && apt install -y curl diff --git a/package.json b/package.json new file mode 100644 index 0000000..48a528a --- /dev/null +++ b/package.json @@ -0,0 +1,23 @@ +{ + "name": "esi-opticks", + "version": "1.2.0", + "description": "esi shell project", + "repository": { + "type": "git", + "url": "git+https://github.com/BNLNPPS/esi-opticks.git" + }, + "keywords": [], + "author": "BNL NPPS", + "license": "MIT", + "bugs": { + "url": "https://github.com/BNLNPPS/esi-opticks/issues" + }, + "homepage": "https://github.com/BNLNPPS/esi-opticks#readme", + "devDependencies": { + "@semantic-release/changelog": "^6.0.3", + "@semantic-release/commit-analyzer": "^12.0.0", + "@semantic-release/git": "^10.0.1", + "@semantic-release/release-notes-generator": "^13.0.0", + "semantic-release": "^23.0.8" + } +}