From 85a818cdace2bbf17def603e881b5b1239efea23 Mon Sep 17 00:00:00 2001 From: Hayleigh Thompson Date: Tue, 19 Sep 2023 23:48:01 +0100 Subject: :wrench: Add a github action to automatically publish when new versions are tagged. --- .github/workflows/release.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..b11ddd0 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,31 @@ +name: release + +on: + push: + tags: ["v*"] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3.1.0 + - uses: erlef/setup-beam@v1.16.0 + with: + otp-version: "26.0.2" + gleam-version: "0.30.5" + - run: cargo install tomlq + - run: | + if [ "v$(tomlq version -f gleam.toml)" == "${{ github.ref_name }}" ]; then + exit 0 + fi + echo "tag does not match version in gleam.toml, refusing to publish" + exit 1 + - run: gleam format --check src test + - run: gleam test --target erlang + - run: gleam test --target javascript + - run: gleam publish -y + env: + HEXPM_USER: ${{ secrets.HEX_USERNAME }} + HEXPM_PASS: ${{ secrets.HEX_PASSWORD }} + + - uses: softprops/action-gh-release@v1 -- cgit v1.2.3