11name: Build image
2-
3- permissions: read-all
4-
52on:
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
1310jobs:
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
0 commit comments