Skip to content

Commit

Permalink
feat: setup semantic release
Browse files Browse the repository at this point in the history
  • Loading branch information
plexoos committed Apr 25, 2024
1 parent 23183af commit 0515111
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 0 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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
15 changes: 15 additions & 0 deletions .releaserc.yaml
Original file line number Diff line number Diff line change
@@ -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}"
7 changes: 7 additions & 0 deletions Dockerfile.test
Original file line number Diff line number Diff line change
@@ -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
23 changes: 23 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -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"
}
}

0 comments on commit 0515111

Please sign in to comment.