-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
125 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import argparse | ||
import json | ||
import requests | ||
import types | ||
|
||
parser = argparse.ArgumentParser() | ||
parser.add_argument("token", help="GitHub token") | ||
args = parser.parse_args() | ||
|
||
domain = "api.github.com" | ||
org = "BNLNPPS" | ||
package_type = "container" | ||
package_name = "esi-opticks" | ||
|
||
api_url = f"https://{domain}/orgs/{org}/packages/{package_type}/{package_name}/versions" | ||
|
||
respjson = requests.get(api_url, auth=("token", args.token)) | ||
entries = json.loads(respjson.text, object_hook=lambda d: types.SimpleNamespace(**d)) | ||
|
||
for e in entries: | ||
if not e.metadata.container.tags: | ||
response = requests.delete(api_url + f"/{e.id}", auth=("token", args.token)) | ||
print("delete", e.id, e.html_url, e.name, response.url, response.status_code) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
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: 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: | ||
tags: ${{ env.IMAGE_NAME }}:prerel | ||
load: true | ||
push: true | ||
cache-from: | | ||
${{ env.IMAGE_NAME }}:latest | ||
${{ env.IMAGE_NAME }}:prerel | ||
- name: Run tests | ||
run: docker run ${{ env.IMAGE_NAME }}:prerel 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: Build container | ||
uses: docker/build-push-action@v5 | ||
with: | ||
tags: | | ||
${{ env.IMAGE_NAME }}:latest | ||
${{ env.IMAGE_NAME }}:${{ steps.semantic.outputs.new_release_version }} | ||
push: true | ||
cache-from: ${{ env.IMAGE_NAME }}:prerel | ||
|
||
cleanup: | ||
runs-on: ubuntu-latest | ||
needs: build-test-release | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- run: .github/workflows/delete_untagged.py ${{ secrets.GITHUB_TOKEN }} |
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
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}" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "esi-opticks", | ||
"version": "0.0.0", | ||
"description": "EIC Simulation Infrastructure", | ||
"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" | ||
} |