Skip to content

Commit

Permalink
VOC-4594 | Update tag naming scheme
Browse files Browse the repository at this point in the history
  • Loading branch information
John-Magtoto committed Sep 27, 2024
1 parent 2b74424 commit 4273115
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
17 changes: 13 additions & 4 deletions .github/workflows/build-versioned-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,23 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Get ref name
id: github-ref-name
run: |
ref='${{ github.ref_name }}'
echo "Tag ref is ${ref}"
# replace any characters not permitted in a docker tag with an underscore
ref_name="${ref//[^A-Za-z0-9\.\-_]/_}"
echo "Sanitised ref name is ${ref_name}"
echo "ref=${ref_name}" >>"${GITHUB_OUTPUT}"
- name: Get docker image tag
id: docker-image-tag
run: |
sha_short=$(git rev-parse --short HEAD)
timestamp=$(date +'%Y%m%d-%H%M%S')
mosquitto_version="2.0.18"
sha_tag="${mosquitto_version}-${sha_short}"
timestamp_tag="${mosquitto_version}-${timestamp}"
timestamp=$(date +'%Y%m%d_%H%M%S')
sha_tag="${ref}-${sha_short}"
timestamp_tag="${ref}-${timestamp}"
echo "Docker image tags are ${sha_tag} and ${timestamp_tag}"
echo "sha_tag=${sha_tag}" >>"${GITHUB_OUTPUT}"
echo "timestamp_tag=${timestamp_tag}" >>"${GITHUB_OUTPUT}"
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@ topic # both 0
topic $SYS/# both 0
```

## Docker Image and GitHub Release creation
## GitHub Releases and Docker image creation

To create a Docker Image from this repo, first create a GitHub release. This can be done by going to the [releases page](https://github.com/Vocovo/docker-mosquitto/releases) in GitHub.

The following naming scheme is used for the release and the git tag `v<mosquitto_version>+<count>` (e.g. `v2.0.18+1`).
The following naming scheme is used for the release and the git tag `v<mosquitto_version>-<count>` (e.g. `v2.0.18-1`).

After the release is created, run the **Build Versioned Image** workflow with the correct tag selected. This will build the Docker Image.
After the release is created, run the **Build Versioned Image** workflow with the correct tag selected. This will build the Docker Image tagged with `<github_tag_ref>-<timestamp>` (e.g. `2.0.18-1-20240923_103524`) and `<github_tag_ref>-<short_sha>` (e.g. `2.0.18-1-384b471`)

Final step is to update the GitHub release information and attach the produced Docker image.

0 comments on commit 4273115

Please sign in to comment.