Repository navigation
70 lines (61 loc) · 2.05 KB
/
Copy pathbuild-docker.yml
File metadata and controls
70 lines (61 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: Build Docker image
on:
workflow_dispatch:
push:
branches:
- develop
tags:
- 'v1.*.*'
concurrency:
group: docker-${{ github.ref }}
cancel-in-progress: true
jobs:
docker:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v7
- name: Add git environment variables
id: env-variables
run: |
echo "BBP_GIT_INFO=\"$(git rev-parse HEAD) $(date --iso-8601=seconds)\"" >> "$GITHUB_OUTPUT"
git rev-parse HEAD > ogc/bblocks/_VERSION
- name: Log in to the Container registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v6
with:
images: ghcr.io/opengeospatial/bblocks-postprocess
tags: |
type=ref,event=branch
type=ref,event=tag
type=raw,value=master,enable=${{ startsWith(github.ref, 'refs/tags/v1.') }}
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v1.') }}
type=raw,value=v1,enable=${{ startsWith(github.ref, 'refs/tags/v1.') }}
- name: Build and push Docker image
uses: docker/build-push-action@v7
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
BBP_GIT_INFO=${{ steps.env-variables.outputs.BBP_GIT_INFO }}
- name: Force-move v1 tag to this release
if: startsWith(github.ref, 'refs/tags/v1.')
run: |
git tag -f v1
git push origin v1 --force
- name: Create GitHub release
if: startsWith(github.ref, 'refs/tags/v1.')
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release create ${{ github.ref_name }} --generate-notes