Skip to content

Commit 63ff56c

Browse files
committed
revised tag automation
1 parent 4ff4f4b commit 63ff56c

File tree

3 files changed

+57
-9
lines changed

3 files changed

+57
-9
lines changed

.github/workflows/build-image.yaml

Lines changed: 49 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
name: Build image
2-
32
permissions: read-all
4-
53
on:
64
push:
75
branches: ["main"]
@@ -11,9 +9,52 @@ on:
119
branches: [main]
1210

1311
jobs:
14-
call-build-image:
15-
uses: UW-Macrostrat/build-push/.github/workflows/build-push.yaml@main
16-
secrets: inherit
17-
with:
18-
context: .
19-
image: "hub.opensciencegrid.org/macrostrat/web"
12+
docker:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v3
17+
with:
18+
submodules: "recursive"
19+
- name: Docker meta
20+
id: meta
21+
uses: docker/metadata-action@v4
22+
with:
23+
images: hub.opensciencegrid.org/macrostrat/web
24+
# New: apply the 'latest' tag only to non-prerelease semver tags
25+
tags: |
26+
type=raw,value=sha-{{sha}}
27+
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, '-')}}
28+
type=ref,event=pr,suffix=-{{date 'YYYYMMDDHHmmss'}}
29+
type=ref,event=branch,suffix=-{{date 'YYYYMMDDHHmmss'}}
30+
type=ref,event=tag,suffix=-{{date 'YYYYMMDDHHmmss'}}
31+
type=semver,pattern={{version}}
32+
type=semver,pattern={{version}},suffix=-{{date 'YYYYMMDDHHmmss'}}
33+
34+
# When a PRODUCTION tag (vX.Y.Z) is pushed → also tag staging and dev
35+
type=raw,value=main-{{date 'YYYYMMDDHHmmss'}},enable=${{ startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, '-') }}
36+
type=semver,pattern={{version}},suffix=-beta.{{date 'YYYYMMDDHHmmss'}},enable=${{ startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, '-') }}
37+
type=semver,pattern={{version}},suffix=-beta,enable=${{ startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, '-') }}
38+
39+
# When a STAGING prerelease tag (vX.Y.Z-*) is pushed → also tag dev
40+
type=raw,value=main-{{date 'YYYYMMDDHHmmss'}},enable=${{ startsWith(github.ref, 'refs/tags/v') && contains(github.ref, '-') }}
41+
flavor: |
42+
latest=false
43+
- name: Set up Docker Buildx
44+
uses: docker/setup-buildx-action@v2
45+
46+
- name: Login to OSG DockerHub
47+
uses: docker/login-action@v2
48+
with:
49+
registry: hub.opensciencegrid.org
50+
username: ${{ vars.HARBOR_CLI_NAME }}
51+
password: ${{ secrets.HARBOR_CLI_SECRET }}
52+
- name: Build and push
53+
uses: docker/build-push-action@v3
54+
with:
55+
context: .
56+
push: true
57+
tags: ${{ steps.meta.outputs.tags }}
58+
labels: ${{ steps.meta.outputs.labels }}
59+
cache-from: type=gha
60+
cache-to: type=gha,mode=max

Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,10 @@ all:
33
git config --local submodule.recurse true
44
git submodule update --init --recursive
55
yarn install
6+
VERSION := $(shell node -p "require('./package.json').version")
7+
8+
release:
9+
# Ensure that the repository is clean
10+
git diff-index --quiet HEAD --
11+
git tag -a v$(VERSION) -m "Version $(VERSION)"
12+
git push origin tag v$(VERSION)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@macrostrat/web",
33
"private": true,
4-
"version": "5.2.0",
4+
"version": "5.2.1-beta.1",
55
"description": "Macrostrat map interface",
66
"type": "module",
77
"scripts": {

0 commit comments

Comments
 (0)