|
1 | 1 | name: Build image |
2 | | - |
3 | 2 | permissions: read-all |
4 | | - |
5 | 3 | on: |
6 | 4 | push: |
7 | 5 | branches: ["main"] |
|
11 | 9 | branches: [main] |
12 | 10 |
|
13 | 11 | 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 |
0 commit comments