From e777ee294a8b111e7eeb4ebc1205eb86fe0ae39a Mon Sep 17 00:00:00 2001 From: Pierrot Date: Wed, 6 Dec 2023 12:01:20 +0100 Subject: [PATCH] Release workflow (#827) * Release workflow This PR adds a release workflow that build an artefact with dune-release. The workflow runs only on branch `v*.*.x`. Should be tested on the branch `v2.5.x`. * Replace make_release by the Release workflow * Test the workflow on this PR * Trigger the workflow * Trigger the workflow * Use the prelease of opam We use the new flag `allow-prelease-opam` of the GitHub action `setup-ocaml` to use the prelease version `2.2` of opam. * Use the latest tag on the branch in the tarball * Try to fetch tags with the GitHub action `checkout` By default, this GitHub action doesn't retrieve the tags of the current branch but we need to get these tags for `dune-release`. * Use the current commit for the name of the artefact * Run the release workflow only on `v*.*.*` branches * Use workflow_dispatch * Use OCaml 4.14.1 for the release workflow --- .github/workflows/build.yml | 25 --------------------- .github/workflows/release.yml | 41 +++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 25 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f52b608b8..79d43a056 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -81,28 +81,3 @@ jobs: uses: getsentry/action-git-diff-suggestions@main with: message: 'The following changes have been made after `make`:' - - make_release: - name: Make package release - runs-on: ubuntu-latest - - if: github.event_name == 'pull_request' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/next' - - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - persist-credentials: false - - - name: Use OCaml ${{ env.OCAML_DEFAULT_VERSION }} - uses: ocaml/setup-ocaml@v2 - with: - allow-prerelease-opam: true - ocaml-compiler: ${{ env.OCAML_DEFAULT_VERSION }} - dune-cache: true - - - name: Install dependencies - run: opam exec -- make deps - - - name: Run make install - run: opam exec -- make install diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..cf41a207e --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,41 @@ +name: Release + +on: + workflow_dispatch + +env: + OCAML_DEFAULT_VERSION: 4.14.1 + OPAMYES: true + +jobs: + dune_release: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + persist-credentials: false + fetch-depth: 0 + fetch-tags: true + + - name: Use OCaml ${{ env.OCAML_DEFAULT_VERSION }} + uses: ocaml/setup-ocaml@v2 + with: + allow-prerelease-opam: true + ocaml-compiler: ${{ env.OCAML_DEFAULT_VERSION }} + dune-cache: true + + - name: Install dependencies + run: opam exec -- make deps + + - name: Install dune-release + run: opam install dune-release + + - name: Build the distribution archive + run: opam exec -- dune-release distrib + + - name: Upload the artefact + uses: actions/upload-artifact@v3 + with: + name: alt-ergo-${{github.sha}}.tbz + path: _build/alt-ergo-*.tbz