chore: set up git_ops and auto-releasing
This commit is contained in:
parent
be8fc9d6f7
commit
9623f052e4
119
.gitlab-ci.yml
119
.gitlab-ci.yml
|
@ -1,42 +1,76 @@
|
|||
image: elixir:latest
|
||||
|
||||
cache:
|
||||
key: "$CI_JOB_NAME"
|
||||
paths:
|
||||
- deps
|
||||
- _build
|
||||
- /root/.mix
|
||||
stages:
|
||||
- build
|
||||
- test
|
||||
- release
|
||||
|
||||
variables:
|
||||
MIX_ENV: "test"
|
||||
PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/"
|
||||
HEX_HOME: "$CI_PROJECT_DIR/.hex"
|
||||
MIX_HOME: "$CI_PROJECT_DIR/.mix"
|
||||
|
||||
before_script:
|
||||
- mix local.hex --force
|
||||
- mix local.rebar --force
|
||||
- mix deps.get --only test
|
||||
build:
|
||||
image: elixir:latest
|
||||
stage: build
|
||||
cache:
|
||||
key: "$CI_JOB_NAME"
|
||||
paths:
|
||||
- deps
|
||||
- _build
|
||||
- .hex
|
||||
- .mix
|
||||
script:
|
||||
- mix local.hex --force
|
||||
- mix local.rebar --force
|
||||
- mix deps.get
|
||||
- mix deps.compile
|
||||
- mix git_ops.project_info -f dotenv > project_info.env
|
||||
artifacts:
|
||||
paths:
|
||||
- _build/
|
||||
- deps/
|
||||
- .hex
|
||||
- .mix
|
||||
reports:
|
||||
dotenv: project_info.env
|
||||
|
||||
test:
|
||||
image: elixir:latest
|
||||
dependencies:
|
||||
- build
|
||||
stage: test
|
||||
script:
|
||||
- mix test
|
||||
|
||||
credo:
|
||||
image: elixir:latest
|
||||
dependencies:
|
||||
- build
|
||||
stage: test
|
||||
script:
|
||||
- mix credo
|
||||
|
||||
audit:
|
||||
image: elixir:latest
|
||||
dependencies:
|
||||
- build
|
||||
stage: test
|
||||
script:
|
||||
- mix hex.audit
|
||||
|
||||
format:
|
||||
image: elixir:latest
|
||||
dependencies:
|
||||
- build
|
||||
stage: test
|
||||
script:
|
||||
- mix format --check-formatted
|
||||
|
||||
pages:
|
||||
stage: deploy
|
||||
image: elixir:latest
|
||||
dependencies:
|
||||
- build
|
||||
stage: release
|
||||
script:
|
||||
- mix docs -o public
|
||||
artifacts:
|
||||
|
@ -45,12 +79,61 @@ pages:
|
|||
only:
|
||||
- master
|
||||
|
||||
package:
|
||||
stage: deploy
|
||||
git_ops:
|
||||
image: elixir:latest
|
||||
dependencies:
|
||||
- build
|
||||
stage: release
|
||||
only:
|
||||
- /^v[0-9]+\.[0-9]+\.[0-9]+$/
|
||||
refs:
|
||||
- master
|
||||
except:
|
||||
variables:
|
||||
- $CI_COMMIT_MESSAGE =~ /chore\:\ release version/
|
||||
script:
|
||||
- mix hex.build
|
||||
- |
|
||||
export OLD_APP_VERSION=$APP_VERSION
|
||||
mkdir -p artifacts
|
||||
git config --global user.name "Gitlab Runner for ${GITLAB_USER_NAME}"
|
||||
git config --global user.email "${GITLAB_USER_EMAIL}"
|
||||
mix git_ops.release --yes || true
|
||||
mix git_ops.project_info -f shell > artifacts/env
|
||||
source artifacts/env
|
||||
if [ "v${OLD_APP_VERSION}" != "v${APP_VERSION}" ]; then
|
||||
mix hex.build -o "artifacts/${APP_NAME}-${APP_VERSION}.tar"
|
||||
gzip "artifacts/${APP_NAME}-${APP_VERSION}.tar"
|
||||
mix docs && tar zcvf "artifacts/${APP_NAME}-${APP_VERSION}-docs.tar.gz" doc/
|
||||
curl --header "JOB_TOKEN: ${CI_JOB_TOKEN}" --upload-file "artifacts/${APP_NAME}-${APP_VERSION}.tar.gz" "${PACKAGE_REGISTRY_URL}/${APP_NAME}/${APP_VERSION}/${APP_NAME}-${APP_VERSION}.tar.gz"
|
||||
curl --header "JOB_TOKEN: ${CI_JOB_TOKEN}" --upload-file "artifacts/${APP_NAME}-${APP_VERSION}-docs.tar.gz" "${PACKAGE_REGISTRY_URL}/${APP_NAME}/${APP_VERSION}/${APP_NAME}-${APP_VERSION}-docs.tar.gz"
|
||||
git push "https://project_${CI_PROJECT_ID}_bot:${RELEASE_TOKEN}@gitlab.com/${CI_PROJECT_PATH}.git" "HEAD:${CI_COMMIT_REF_NAME}" "refs/tags/v${APP_VERSION}"
|
||||
fi
|
||||
artifacts:
|
||||
paths:
|
||||
- "pca9641-*.tar"
|
||||
- artifacts/*
|
||||
|
||||
release-gitlab:
|
||||
image: registry.gitlab.com/gitlab-org/release-cli:latest
|
||||
dependencies:
|
||||
- build
|
||||
stage: release
|
||||
only:
|
||||
- tags
|
||||
- /^v\d+\.\d+\.\d+(-\w+)?$/
|
||||
script:
|
||||
- release-cli create \
|
||||
--name "Release ${APP_NAME} ${APP_VERSION}" \
|
||||
--description "./CHANGELOG.md" \
|
||||
--tag-name "v${APP_VERSION}" \
|
||||
--assets-link "{\"name\":\"${APP_NAME}-${APP_VERSION}.tar.gz\",\"url\":\"${PACKAGE_REGISTRY_URL}/${APP_NAME}/${APP_VERSION}/${APP_NAME}-${APP_VERSION}.tar.gz\"}" \
|
||||
--assets-link "{\"name\":\"${APP_NAME}-${APP_VERSION}-docs.tar.gz\",\"url\":\"${PACKAGE_REGISTRY_URL}/${APP_NAME}/${APP_VERSION}/${APP_NAME}-${APP_VERSION}-docs.tar.gz\"}"
|
||||
|
||||
release-hex:
|
||||
image: elixir:latest
|
||||
dependencies:
|
||||
- build
|
||||
stage: release
|
||||
only:
|
||||
- tags
|
||||
- /^v\d+\.\d+\.\d+(-\w+)?$/
|
||||
script:
|
||||
- mix hex.publish --yes
|
||||
|
|
11
CHANGELOG.md
Normal file
11
CHANGELOG.md
Normal file
|
@ -0,0 +1,11 @@
|
|||
# Change Log
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](Https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
<!-- changelog -->
|
||||
|
||||
## [v1.0.0](https://gitlab.com/jimsy/pca9641/compare/v1.0.0...v1.0.0) (2020-12-28)
|
||||
|
||||
|
||||
|
|
@ -15,7 +15,7 @@ by adding `pca9641` to your list of dependencies in `mix.exs`:
|
|||
```elixir
|
||||
def deps do
|
||||
[
|
||||
{:pca9641, "~> 0.1.0"}
|
||||
{:pca9641, "~> 1.0.0"}
|
||||
]
|
||||
end
|
||||
```
|
||||
|
|
|
@ -1 +1,9 @@
|
|||
import Config
|
||||
|
||||
config :git_ops,
|
||||
mix_project: Mix.Project.get!(),
|
||||
changelog_file: "CHANGELOG.md",
|
||||
repository_url: "https://gitlab.com/jimsy/pca9641",
|
||||
manage_mix_version?: true,
|
||||
manage_readme_version: "README.md",
|
||||
version_tag_prefix: "v"
|
||||
|
|
11
mix.exs
11
mix.exs
|
@ -1,10 +1,12 @@
|
|||
defmodule PCA9641.MixProject do
|
||||
use Mix.Project
|
||||
|
||||
@version "1.0.0"
|
||||
|
||||
def project do
|
||||
[
|
||||
app: :pca9641,
|
||||
version: "1.0.0",
|
||||
version: @version,
|
||||
elixir: "~> 1.9",
|
||||
start_permanent: Mix.env() == :prod,
|
||||
description: "Driver for PCA9641 2-channel I2C bus master arbiter chip",
|
||||
|
@ -35,10 +37,11 @@ defmodule PCA9641.MixProject do
|
|||
[
|
||||
{:circuits_gpio, "~> 0.4", optional: true},
|
||||
{:circuits_i2c, "~> 0.3", optional: true},
|
||||
{:credo, "~> 1.1", only: [:dev, :test], runtime: false},
|
||||
{:earmark, ">= 0.0.0", only: [:dev, :test]},
|
||||
{:credo, "~> 1.1", only: ~w[dev test]a, runtime: false},
|
||||
{:earmark, ">= 0.0.0", only: ~w[dev test]a},
|
||||
{:elixir_ale, "~> 1.2", optional: true},
|
||||
{:ex_doc, ">= 0.0.0", only: [:dev, :test]},
|
||||
{:ex_doc, ">= 0.0.0", only: ~w[dev test]a},
|
||||
{:git_ops, "~> 2.3", only: ~w[dev test]a, runtime: false},
|
||||
{:mimic, "~> 1.1", only: :test},
|
||||
{:wafer, "~> 0.3"}
|
||||
]
|
||||
|
|
2
mix.lock
2
mix.lock
|
@ -8,6 +8,8 @@
|
|||
"elixir_ale": {:hex, :elixir_ale, "1.2.1", "07ac2f17a0191b8bd3b0df6b526c7f699a3a4d690c9def573fcb5824eef24d98", [:make, :mix], [{:elixir_make, "~> 0.4", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "bfb099137500a3b8c4a1750cf07f2d704897ef9feac3412064bf9edc7d74193c"},
|
||||
"elixir_make": {:hex, :elixir_make, "0.6.2", "7dffacd77dec4c37b39af867cedaabb0b59f6a871f89722c25b28fcd4bd70530", [:mix], [], "hexpm", "03e49eadda22526a7e5279d53321d1cced6552f344ba4e03e619063de75348d9"},
|
||||
"ex_doc": {:hex, :ex_doc, "0.23.0", "a069bc9b0bf8efe323ecde8c0d62afc13d308b1fa3d228b65bca5cf8703a529d", [:mix], [{:earmark_parser, "~> 1.4.0", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}], "hexpm", "f5e2c4702468b2fd11b10d39416ddadd2fcdd173ba2a0285ebd92c39827a5a16"},
|
||||
"git_cli": {:hex, :git_cli, "0.3.0", "a5422f9b95c99483385b976f5d43f7e8233283a47cda13533d7c16131cb14df5", [:mix], [], "hexpm", "78cb952f4c86a41f4d3511f1d3ecb28edb268e3a7df278de2faa1bd4672eaf9b"},
|
||||
"git_ops": {:hex, :git_ops, "2.3.0", "a77f91b810d874e1abf5f415f335959a2dfc3613cbcd28c7c05b97c666339fda", [:mix], [{:git_cli, "~> 0.2", [hex: :git_cli, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "849bd53b7992963b3fdfebcdd0c946f4aab3f6ffbcfa5668b3e83cd5aeca0a2f"},
|
||||
"jason": {:hex, :jason, "1.1.2", "b03dedea67a99223a2eaf9f1264ce37154564de899fd3d8b9a21b1a6fd64afe7", [:mix], [{:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "fdf843bca858203ae1de16da2ee206f53416bbda5dc8c9e78f43243de4bc3afe"},
|
||||
"makeup": {:hex, :makeup, "1.0.5", "d5a830bc42c9800ce07dd97fa94669dfb93d3bf5fcf6ea7a0c67b2e0e4a7f26c", [:mix], [{:nimble_parsec, "~> 0.5 or ~> 1.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "cfa158c02d3f5c0c665d0af11512fed3fba0144cf1aadee0f2ce17747fba2ca9"},
|
||||
"makeup_elixir": {:hex, :makeup_elixir, "0.15.0", "98312c9f0d3730fde4049985a1105da5155bfe5c11e47bdc7406d88e01e4219b", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.1", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "75ffa34ab1056b7e24844c90bfc62aaf6f3a37a15faa76b07bc5eba27e4a8b4a"},
|
||||
|
|
Loading…
Reference in a new issue