Skip to content

Commit f4f9b3c

Browse files
Added a workflow for publishing the Docker container to GitHub's package registry
1 parent 92677e9 commit f4f9b3c

File tree

2 files changed

+58
-1
lines changed

2 files changed

+58
-1
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Publish Docker image
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
push:
7+
branches: [master]
8+
tags: ["*"]
9+
10+
permissions:
11+
contents: read
12+
packages: write
13+
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.ref }}
16+
cancel-in-progress: true
17+
18+
jobs:
19+
docker:
20+
runs-on: ubuntu-24.04
21+
env:
22+
REGISTRY: ghcr.io
23+
IMAGE_NAME: ghcr.io/mavlink/mavlink2rest
24+
steps:
25+
- uses: actions/checkout@v4
26+
27+
- uses: docker/setup-buildx-action@v3
28+
29+
- name: Log in to GHCR
30+
uses: docker/login-action@v3
31+
with:
32+
registry: ${{ env.REGISTRY }}
33+
username: ${{ github.actor }}
34+
password: ${{ secrets.GITHUB_TOKEN }}
35+
36+
- name: Docker metadata (tags, labels)
37+
id: meta
38+
uses: docker/metadata-action@v5
39+
with:
40+
images: ${{ env.IMAGE_NAME }}
41+
tags: |
42+
type=sha,prefix=,format=long
43+
type=ref,event=tag
44+
type=raw,value=latest
45+
46+
- name: Build and push
47+
uses: docker/build-push-action@v6
48+
with:
49+
context: .
50+
file: ./Dockerfile
51+
push: true
52+
tags: ${{ steps.meta.outputs.tags }}
53+
labels: ${{ steps.meta.outputs.labels }}
54+
platforms: linux/amd64,linux/arm64
55+
cache-from: type=gha
56+
cache-to: type=gha,mode=max

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
[![Deploy mavlink2rest](https://github.com/mavlink/mavlink2rest/actions/workflows/deploy.yml/badge.svg)](https://github.com/mavlink/mavlink2rest/actions/workflows/deploy.yml)
44
[![Test](https://github.com/mavlink/mavlink2rest/actions/workflows/test.yml/badge.svg)](https://github.com/mavlink/mavlink2rest/actions/workflows/test.yml)
5+
[![Docker image (GHCR): ghcr.io/mavlink/mavlink2rest](https://img.shields.io/badge/docker-ghcr.io%2Fmavlink%2Fmavlink2rest-2496ED?logo=docker&logoColor=white)](https://github.com/mavlink/mavlink2rest/pkgs/container/mavlink2rest)
56
[![Cargo download](https://img.shields.io/crates/d/mavlink2rest)](https://crates.io/crates/mavlink2rest)
67
[![Crate info](https://img.shields.io/crates/v/mavlink2rest.svg)](https://crates.io/crates/mavlink2rest)
78
[![Documentation](https://docs.rs/mavlink2rest/badge.svg)](https://docs.rs/mavlink2rest)
@@ -122,7 +123,7 @@ docker build --build-arg TARGET_ARCH=x86_64-unknown-linux-musl -t mavlink/mavlin
122123
}
123124
}
124125
```
125-
> :sunglasses: This is really hand when creating messages.
126+
> :sunglasses: This is really hand when creating messages.
126127
* ... and a **status** structure defined as:
127128
```js
128129
"status": {

0 commit comments

Comments
 (0)