diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..a951fcd --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,69 @@ +name: Release +on: + release: + types: ["created"] + +jobs: + build_binary: + name: Build the cli binary + strategy: + matrix: + # os: [windows-latest, ubuntu-20.04, ubuntu-18.04, macos-12, macos-12-m1] + os: [ubuntu-18.04, macos-12, macos-12-m1] + runs-on: ${{ matrix.os }} + env: + MIX_ENV: prod + steps: + - uses: actions/checkout@v2 + - uses: erlef/setup-beam@v1 + if: ${{ !startsWith(matrix.os, 'macos')}} + with: + otp-version: 24.3 + elixir-version: 1.14 + - name: Install build tools on windows + if: ${{ startsWith(matrix.os, 'windows')}} + run: | + choco install -y zstandard make + Add-Content -Path $env:GITHUB_ENV -Value "CC=gcc" + - name: Setup elixir on mac + if: ${{ startsWith(matrix.os, 'macos')}} + run: | + brew update --preinstall + brew install erlang@25 + brew install elixir + mix local.hex --force + mix local.rebar --force + - name: Setup dependency caching + if: ${{ startsWith(matrix.os, 'macos')}} + uses: actions/cache@v3 + with: + path: | + deps + _build + key: ${{ runner.os }}-mix-${{ hashfiles('**/mix.lock')}} + restore-keys: | + ${{ runner.os }}-mix- + - run: mix deps.get + - run: mix release + - uses: actions/upload-artifact@v3 + with: + name: ${{ matrix.os }}-binary + path: _build/prod/rel/bakeware/electric + attach_artifacts: + name: Attach artifacts to release + if: github.event_name == 'release' + runs-on: ubuntu-20.04 + needs: build_binary + steps: + - uses: actions/download-artifact@v3 + with: + path: ./ + - run: | + mv ubuntu-18.04-binary/electic electricsql_cli_${{ github.event.release.tag_name }}_linux + mv macos-12-binary/electic electricsql_cli_${{ github.event.release.tag_name }}_intel_mac + mv macos-12-m1-binary/electic electricsql_cli_${{ github.event.release.tag_name }}_arm_mac + - uses: irongut/EditRelease@v1.2.0 + with: + token: ${{ secrets.GITHUB_TOKEN }} + id: ${{ github.event.release.id }} + files: "electricsql_cli_${{ github.event.release.tag_name }}_linux,electricsql_cli_${{ github.event.release.tag_name }}_intel_mac,electricsql_cli_${{ github.event.release.tag_name }}_arm_mac" diff --git a/mix.exs b/mix.exs index 5626bed..1b87ccd 100644 --- a/mix.exs +++ b/mix.exs @@ -39,14 +39,14 @@ defmodule Electric.MixProject do defp deps do [ {:bakeware, "~> 0.2.4", runtime: false}, - {:cli_spinners, [git: "git@github.com:thruflo/elixir_cli_spinners.git"]}, + {:cli_spinners, [github: "thruflo/elixir_cli_spinners"]}, {:dialyxir, "~> 1.0", only: :dev, runtime: false}, {:ex_doc, "~> 0.28", only: :dev, runtime: false}, {:exconstructor, "~> 1.2.6"}, {:git_hooks, "== 0.6.5", only: :dev, runtime: false}, {:jason, "~> 1.3.0"}, {:memoize, "~> 1.4"}, - {:optimus, [git: "git@github.com:thruflo/optimus.git"]}, + {:optimus, [github: "thruflo/optimus"]}, {:req, "~> 0.3.0"}, {:exqlite, "~> 0.11.3"}, {:uuid, "~> 1.1.8"} diff --git a/mix.lock b/mix.lock index 523fae3..6955b37 100644 --- a/mix.lock +++ b/mix.lock @@ -2,9 +2,9 @@ "bakeware": {:hex, :bakeware, "0.2.4", "0aaf49b34f4bab2aa433f9ff1485d9401e421603160abd6d269c469fc7b65212", [:make, :mix], [{:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "7b97bcf6fbeee53bb32441d6c495bf478d26f9575633cfef6831e421e86ada6d"}, "blankable": {:hex, :blankable, "1.0.0", "89ab564a63c55af117e115144e3b3b57eb53ad43ba0f15553357eb283e0ed425", [:mix], [], "hexpm", "7cf11aac0e44f4eedbee0c15c1d37d94c090cb72a8d9fddf9f7aec30f9278899"}, "castore": {:hex, :castore, "0.1.18", "deb5b9ab02400561b6f5708f3e7660fc35ca2d51bfc6a940d2f513f89c2975fc", [:mix], [], "hexpm", "61bbaf6452b782ef80b33cdb45701afbcf0a918a45ebe7e73f1130d661e66a06"}, + "cli_spinners": {:git, "https://github.com/thruflo/elixir_cli_spinners.git", "a29e72239025afefa85426cb05722f05a20bdd6e", []}, "connection": {:hex, :connection, "1.1.0", "ff2a49c4b75b6fb3e674bfc5536451607270aac754ffd1bdfe175abe4a6d7a68", [:mix], [], "hexpm", "722c1eb0a418fbe91ba7bd59a47e28008a189d47e37e0e7bb85585a016b2869c"}, "db_connection": {:hex, :db_connection, "2.4.2", "f92e79aff2375299a16bcb069a14ee8615c3414863a6fef93156aee8e86c2ff3", [:mix], [{:connection, "~> 1.0", [hex: :connection, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "4fe53ca91b99f55ea249693a0229356a08f4d1a7931d8ffa79289b145fe83668"}, - "cli_spinners": {:git, "git@github.com:thruflo/elixir_cli_spinners.git", "a29e72239025afefa85426cb05722f05a20bdd6e", []}, "dialyxir": {:hex, :dialyxir, "1.2.0", "58344b3e87c2e7095304c81a9ae65cb68b613e28340690dfe1a5597fd08dec37", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "61072136427a851674cab81762be4dbeae7679f85b1272b6d25c3a839aff8463"}, "earmark_parser": {:hex, :earmark_parser, "1.4.26", "f4291134583f373c7d8755566122908eb9662df4c4b63caa66a0eabe06569b0a", [:mix], [], "hexpm", "48d460899f8a0c52c5470676611c01f64f3337bad0b26ddab43648428d94aabc"}, "elixir_make": {:hex, :elixir_make, "0.6.3", "bc07d53221216838d79e03a8019d0839786703129599e9619f4ab74c8c096eac", [:mix], [], "hexpm", "f5cbd651c5678bcaabdbb7857658ee106b12509cd976c2c2fca99688e1daf716"}, @@ -25,7 +25,7 @@ "nimble_options": {:hex, :nimble_options, "0.4.0", "c89babbab52221a24b8d1ff9e7d838be70f0d871be823165c94dd3418eea728f", [:mix], [], "hexpm", "e6701c1af326a11eea9634a3b1c62b475339ace9456c1a23ec3bc9a847bca02d"}, "nimble_parsec": {:hex, :nimble_parsec, "1.2.3", "244836e6e3f1200c7f30cb56733fd808744eca61fd182f731eac4af635cc6d0b", [:mix], [], "hexpm", "c8d789e39b9131acf7b99291e93dae60ab48ef14a7ee9d58c6964f59efb570b0"}, "nimble_pool": {:hex, :nimble_pool, "0.2.6", "91f2f4c357da4c4a0a548286c84a3a28004f68f05609b4534526871a22053cde", [:mix], [], "hexpm", "1c715055095d3f2705c4e236c18b618420a35490da94149ff8b580a2144f653f"}, - "optimus": {:git, "git@github.com:thruflo/optimus.git", "a551907874750e596424f0465f40d7792523881f", []}, + "optimus": {:git, "https://github.com/thruflo/optimus.git", "a551907874750e596424f0465f40d7792523881f", []}, "recase": {:hex, :recase, "0.7.0", "3f2f719f0886c7a3b7fe469058ec539cb7bbe0023604ae3bce920e186305e5ae", [:mix], [], "hexpm", "36f5756a9f552f4a94b54a695870e32f4e72d5fad9c25e61bc4a3151c08a4e0c"}, "req": {:hex, :req, "0.3.0", "45944bfa0ea21294ad269e2025b9983dd084cc89125c4fc0a8de8a4e7869486b", [:mix], [{:brotli, "~> 0.3.1", [hex: :brotli, repo: "hexpm", optional: true]}, {:ezstd, "~> 1.0", [hex: :ezstd, repo: "hexpm", optional: true]}, {:finch, "~> 0.9", [hex: :finch, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:mime, "~> 1.6 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:nimble_csv, "~> 1.0", [hex: :nimble_csv, repo: "hexpm", optional: true]}, {:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "1212a3e047eede0fa7eeb84c30d08206d44bb120df98b6f6b9a9e04910954a71"}, "telemetry": {:hex, :telemetry, "1.1.0", "a589817034a27eab11144ad24d5c0f9fab1f58173274b1e9bae7074af9cbee51", [:rebar3], [], "hexpm", "b727b2a1f75614774cff2d7565b64d0dfa5bd52ba517f16543e6fc7efcc0df48"},