Skip to content

Commit f2cdfd5

Browse files
committed
testing staging workflow
1 parent 9ad52fd commit f2cdfd5

File tree

3 files changed

+59
-20
lines changed

3 files changed

+59
-20
lines changed

.github/workflows/build-image.yaml

Lines changed: 51 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,59 @@
11
name: Build image
2-
3-
permissions: read-all
4-
52
on:
63
push:
74
branches: ["main"]
85
tags:
9-
- 'v*.*.*' # glob for semver tags (including prereleases)
6+
- "v*.*.*" # glob for semver tags (including prereleases)
107
pull_request:
11-
branches: [ main ]
8+
branches: [main]
129

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

Makefile

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,15 @@ all:
22
docker build -t rockd_website:latest .
33
docker run --rm -it -p 5500:5500 --name rockd_website --env-file .env rockd_website:latest
44

5-
VERSION := $(shell jq -r .version ./package.json)
65

76
TAG := hub.opensciencegrid.org/macrostrat/rockd-website:$(VERSION)
7+
VERSION := $(shell node -p "require('./package.json').version")
8+
9+
release:
10+
# Ensure that the repository is clean
11+
git diff-index --quiet HEAD --
12+
git tag -a v$(VERSION) -m "Version $(VERSION)"
13+
git push origin tag v$(VERSION)
814

915
debug:
1016
docker build -t rockd_website:latest .
@@ -17,10 +23,3 @@ debug:
1723
--env-file .env \
1824
rockd_website:latest \
1925
node --inspect=0.0.0.0:9229 /code/server.js
20-
21-
publish:
22-
# Ensure the git repository is clean
23-
@git diff --quiet || (echo "Uncommitted changes present. Please commit or stash them before publishing." && exit 1)
24-
git tag -a v$(VERSION) -m "Version $(VERSION)"
25-
26-
# testing automated workflow

package.json

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

0 commit comments

Comments
 (0)