Skip to content

Commit b394e07

Browse files
sei-tspencerclaude
andauthored
Chore/auto version update (#629)
* chore: configure automatic version updates via reusable workflow Migrate to the cmu-sei/Crucible-Github-Actions docker-build reusable workflow @docker-v1 and add versionMode/versionFiles inputs to enable automatic version bumping on release. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * migrate to cmu-sei/Crucible-Github-Actions/.github/workflows/docker-build.yaml@docker-v1.1.2 --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 4281df7 commit b394e07

File tree

2 files changed

+15
-64
lines changed

2 files changed

+15
-64
lines changed

.github/workflows/main.yml

Lines changed: 14 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,23 @@
1-
name: Build
1+
name: Build and Publish Image
22

33
on:
44
pull_request:
55
branches:
66
- main
77
push:
8-
branches: [main]
8+
branches:
9+
- main
910
release:
10-
types: ['published']
11-
workflow_dispatch:
12-
inputs:
13-
tagName:
14-
description: 'Tag of the image you want to build and push'
15-
required: true
11+
types: ["published"]
1612

1713
jobs:
18-
build:
19-
runs-on: ubuntu-latest
20-
steps:
21-
- name: Checkout
22-
uses: actions/checkout@v2
23-
24-
- name: Prepare
25-
id: prep
26-
run: |
27-
DOCKER_IMAGE=cmusei/caster-ui
28-
VERSION=development
29-
if [[ ! -z "${{ github.event.inputs.tagName }}" ]]; then
30-
VERSION=${{ github.event.inputs.tagName }}
31-
TAGS="${DOCKER_IMAGE}:${VERSION}"
32-
elif [[ $GITHUB_REF == refs/tags/* ]]; then
33-
VERSION=${GITHUB_REF#refs/tags/}
34-
MAJORMINORVERSION=$(echo $VERSION | grep -oP '(\d+)\.(\d+)')
35-
TAGS="${DOCKER_IMAGE}:${VERSION},${DOCKER_IMAGE}:${MAJORMINORVERSION}"
36-
elif [[ $GITHUB_REF == refs/heads/* ]]; then
37-
VERSION=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's#/+#-#g')
38-
TAGS="${DOCKER_IMAGE}:${VERSION}"
39-
fi
40-
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
41-
echo ::set-output name=push::false
42-
echo "event is pull_request, not pushing image"
43-
else
44-
echo ::set-output name=push::true
45-
echo "event is not pull_request, pushing image"
46-
fi
47-
echo ::set-output name=version::${VERSION}
48-
echo ::set-output name=tags::${TAGS}
49-
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
50-
51-
- name: Set up Docker Buildx
52-
uses: docker/setup-buildx-action@v1
53-
54-
- name: Login to DockerHub
55-
if: github.event_name != 'pull_request'
56-
uses: docker/login-action@v1
57-
with:
58-
username: ${{ secrets.DOCKERHUB_USERNAME }}
59-
password: ${{ secrets.DOCKERHUB_PASSWORD }}
60-
61-
- name: Build and push
62-
uses: docker/build-push-action@v2
63-
with:
64-
context: .
65-
file: ./Dockerfile
66-
push: ${{ steps.prep.outputs.push }}
67-
pull: true
68-
tags: ${{ steps.prep.outputs.tags }}
69-
labels: |
70-
org.opencontainers.image.source=${{ github.event.repository.clone_url }}
71-
org.opencontainers.image.created=${{ steps.prep.outputs.created }}
72-
org.opencontainers.image.revision=${{ github.sha }}
14+
build-and-publish:
15+
name: Build and Publish
16+
uses: cmu-sei/Crucible-Github-Actions/.github/workflows/docker-build.yaml@docker-v1.1.2
17+
with:
18+
imageName: cmusei/caster-ui
19+
versionMode: npm
20+
versionFiles: package.json
21+
secrets:
22+
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
23+
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "caster-ui",
3-
"version": "3.0.5",
3+
"version": "0.0.0",
44
"scriptComments": {
55
"swagger:gen": "// uses swagger-codegen to generate Angular services and models from the API swagger specification",
66
"swagger:gen-win": "// use instead of swagger-gen when running from a Windows machine",

0 commit comments

Comments
 (0)