Skip to content

Commit

Permalink
Add a release CI workflow with a version check
Browse files Browse the repository at this point in the history
Add a CI workflow that is only run when a tag is pushed to
Github, and a check that the ered application vsn is matching
the pushed tag.

application:get_key(ered, vsn) is used to get the vsn version
and the shell will return an error code when the version and
the tag is not matching, which fails the CI job.
  • Loading branch information
bjosv committed Nov 22, 2024
1 parent 4caafcc commit 2e359d7
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Release

# Only run this workflow on pushed tags.
on:
push:
tags:
- '*'

permissions:
contents: read

jobs:
check-version:
name: Check ered application version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install Erlang/OTP
uses: erlef/setup-beam@5304e04ea2b355f03681464e683d92e3b2f18451 # v1.18.2
with:
otp-version: '27.1.2'
rebar3-version: '3.23.0'
- name: Check if vsn matches pushed tag (see src/ered.app.src).
run: |
rebar3 shell --apps ered --eval "$(cat << EOF
Version = "${{ github.ref_name }}",
case application:get_key(ered, vsn) of
{ok, Version} ->
halt(0,[]);
Error ->
io:format(user, "Version check failed, got ~p while pushed tag is ~s~n",
[Error, Version]),
halt(1,[]) %% Version check failed, give exitcode 1.
end.
EOF
)"

0 comments on commit 2e359d7

Please sign in to comment.