Skip to content

Commit 6e93263

Browse files
authored
feat: add CI to build and push docker image to Github package (#1) (#512)
1 parent 9a377a6 commit 6e93263

1 file changed

Lines changed: 37 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ name: "Continuous Integration"
22

33
on:
44
push:
5-
pull_request:
65
branches: [ master ]
6+
pull_request:
77

88
env:
99
AREA: liechtenstein
@@ -117,3 +117,39 @@ jobs:
117117
with:
118118
input: ${{ env.AREA }}.osm.pbf
119119
output: ${{ env.AREA }}.mbtiles
120+
121+
docker-build:
122+
env:
123+
REGISTRY: ghcr.io
124+
IMAGE_NAME: ${{ github.repository }}
125+
126+
runs-on: ubuntu-latest
127+
permissions:
128+
contents: read
129+
packages: write
130+
131+
steps:
132+
- name: Checkout repository
133+
uses: actions/checkout@v3
134+
135+
- name: Log in to the Container registry
136+
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
137+
with:
138+
registry: ${{ env.REGISTRY }}
139+
username: ${{ github.actor }}
140+
password: ${{ secrets.GITHUB_TOKEN }}
141+
142+
- name: Extract metadata (tags, labels) for Docker
143+
id: meta
144+
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
145+
with:
146+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
147+
148+
- name: Build and push Docker image
149+
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
150+
if: ${{ github.ref == 'refs/heads/master'}}
151+
with:
152+
context: .
153+
push: true
154+
tags: ${{ steps.meta.outputs.tags }}
155+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)