Skip to content

Commit

Permalink
Start tracking version history
Browse files Browse the repository at this point in the history
While NervesHub has been running in many production environments,
it has not been versioned with records of changes. This will set
the initial version and start tracking from here.

This will also allow us tag docker builds with version numbers
  • Loading branch information
jjcarstens committed Jun 10, 2022
1 parent 5c239b7 commit 8c1dc08
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 2 deletions.
85 changes: 84 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,18 @@ docker_env: &docker_env
else
TAG=$CIRCLE_TAG
fi
VERSION=$(tr -d '\n' < VERSION)
echo "export DOCKER_TAG=$TAG" >> $BASH_ENV
echo "export DOCKER_VERSION_TAG=$VERSION" >> $BASH_ENV
docker_build_release: &docker_build_release
run:
name: Build docker images
command: |
docker build \
-t nerveshub/$APP_NAME:$DOCKER_TAG \
-t nerveshub/$APP_NAME:$DOCKER_VERSION_TAG \
-t nerveshub/$APP_NAME:latest \
-f apps/$APP_NAME/rel/Dockerfile.build .
Expand All @@ -37,6 +41,9 @@ docker_save: &docker_save
docker save \
nerveshub/$APP_NAME:$DOCKER_TAG \
-o /docker/$APP_NAME-$DOCKER_TAG.tar
docker save \
nerveshub/$APP_NAME:$DOCKER_VERSION_TAG \
-o /docker/$APP_NAME-$DOCKER_VERSION_TAG.tar
docker save \
nerveshub/$APP_NAME:latest \
-o /docker/$APP_NAME-latest.tar
Expand All @@ -47,16 +54,26 @@ docker_import: &docker_import
command: |
docker load \
-i /docker/$APP_NAME-$DOCKER_TAG.tar
docker load \
-i /docker/$APP_NAME-$DOCKER_VERSION_TAG.tar
docker load \
-i /docker/$APP_NAME-latest.tar
docker_push: &docker_push
run:
name: Push docker images to dockerhub
name: Push commit image to dockerhub
command: |
docker login -u $DOCKER_USER -p $DOCKER_PASS
docker push \
nerveshub/$APP_NAME:$DOCKER_TAG
docker_release: &docker_release
run:
name: Release docker images to dockerhub
command: |
docker login -u $DOCKER_USER -p $DOCKER_PASS
docker push \
nerveshub/$APP_NAME:$DOCKER_VERSION_TAG
docker push \
nerveshub/$APP_NAME:latest
Expand Down Expand Up @@ -215,6 +232,45 @@ jobs:
- <<: *docker_import
- <<: *docker_push

release-www:
<<: *defaults
steps:
- checkout
- run: echo "export APP_NAME=nerves_hub_www" >> $BASH_ENV
- <<: *remote_docker
- <<: *docker_env
- restore_cache:
keys:
- docker-www-{{ .Branch }}-{{ .Revision }}
- <<: *docker_import
- <<: *docker_release

release-device:
<<: *defaults
steps:
- checkout
- run: echo "export APP_NAME=nerves_hub_device" >> $BASH_ENV
- <<: *remote_docker
- <<: *docker_env
- restore_cache:
keys:
- docker-device-{{ .Branch }}-{{ .Revision }}
- <<: *docker_import
- <<: *docker_release

release-api:
<<: *defaults
steps:
- checkout
- run: echo "export APP_NAME=nerves_hub_api" >> $BASH_ENV
- <<: *remote_docker
- <<: *docker_env
- restore_cache:
keys:
- docker-api-{{ .Branch }}-{{ .Revision }}
- <<: *docker_import
- <<: *docker_release

workflows:
version: 2
pipeline:
Expand Down Expand Up @@ -262,3 +318,30 @@ workflows:
filters:
branches:
only: main
- release-www:
context: org-global
requires:
- build-www
filters:
branches:
ignore: /.*/
tags:
only: /v.*/
- release-device:
context: org-global
requires:
- build-device
filters:
branches:
ignore: /.*/
tags:
only: /v.*/
- release-api:
context: org-global
requires:
- build-api
filters:
branches:
ignore: /.*/
tags:
only: /v.*/
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Changelog

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

See the [NervesHub documentation] for more information

## [v1.0.0] - 2022-06-10

[v1.0.0]: https://github.com/nerves-hub/nerves_hub_web/releases/tag/v1.0.0

The official start of NervesHub versioning. See the [NervesHub documentation]
for more information and [Custom Deployment](https://docs.nerves-hub.org/nerves-hub/custom-deployment)
guide for setting up your own instance.

[NervesHub documentation]: https://docs.nerves-hub.org
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.0.0
7 changes: 6 additions & 1 deletion mix.exs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
defmodule NervesHubUmbrella.MixProject do
use Mix.Project

@version File.read!("VERSION") |> String.trim()

def project do
[
version: "0.1.0",
version: @version,
apps_path: "apps",
start_permanent: Mix.env() == :prod,
deps: deps(),
Expand All @@ -20,6 +22,7 @@ defmodule NervesHubUmbrella.MixProject do
include_executables_for: [:unix],
runtime_config_path: "apps/nerves_hub_www/config/release.exs",
reboot_system_after_config: true,
version: @version,
applications: [
nerves_hub_www: :permanent
]
Expand All @@ -29,6 +32,7 @@ defmodule NervesHubUmbrella.MixProject do
include_executables_for: [:unix],
runtime_config_path: "apps/nerves_hub_device/config/release.exs",
reboot_system_after_config: true,
version: @version,
applications: [
nerves_hub_device: :permanent
]
Expand All @@ -38,6 +42,7 @@ defmodule NervesHubUmbrella.MixProject do
include_executables_for: [:unix],
runtime_config_path: "apps/nerves_hub_api/config/release.exs",
reboot_system_after_config: true,
version: @version,
applications: [
nerves_hub_api: :permanent
]
Expand Down

0 comments on commit 8c1dc08

Please sign in to comment.