Skip to content

Kind 2 Release

Kind 2 Release #186

Workflow file for this run

name: Kind 2 Release
on:
workflow_dispatch:
# Run the nightly build at 8 AM UTC / 2 AM Central
schedule:
- cron: "0 8 * * *"
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*'
jobs:
get-nightly-ready:
if: github.repository == 'kind2-mc/kind2' && !startsWith(github.event.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Delete old assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
ids=$(gh release view nightly --json assets --jq '.assets | map(.name) | .[]')
for id in $ids;
do
gh release delete-asset nightly $id -y
done
- name: Update nightly tag
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git tag -f nightly
git push --tags -f
create-new-release:
if: github.repository == 'kind2-mc/kind2' && startsWith(github.event.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- name: Create new release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cat > Release_Notes.txt << EOF
TODO:
- Generate and upload user_documentation.pdf
- Replace this text with the release notes
- Publish the release!"
EOF
gh release create $GITHUB_REF_NAME --verify-tag --draft \
--title "Kind 2 $GITHUB_REF_NAME" --notes-file Release_Notes.txt \
--repo $GITHUB_REPOSITORY
build:
if: |
always()
&& github.repository == 'kind2-mc/kind2'
&& contains(needs.*.result, 'success')
&& !contains(needs.*.result, 'failure')
needs: [get-nightly-ready, create-new-release]
strategy:
matrix:
os: [ ubuntu-latest, macos-12, macos-14 ]
ocaml-version: [ 5.1.1 ]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build Kind 2 linux binary
if: runner.os == 'Linux'
uses: docker/build-push-action@v5
with:
file: docker/Dockerfile
context: ./
target: builder
load: true
tags: kind2:latest
- name: Extract Kind 2 linux binary
id: extract
if: runner.os == 'Linux'
uses: shrink/actions-docker-extract@v3
with:
image: kind2:latest
path: /home/opam/kind2-build/bin/kind2
destination: ./bin/
- name: Build Kind 2 macOS binary
if: runner.os == 'macOS'
uses: ./.github/actions/build-kind2
with:
ocaml-version: ${{ matrix.ocaml-version }}
flambda: true
- name: Strip Kind 2 macOS binary
if: runner.os == 'macOS'
run: strip ./bin/kind2
- name: Create asset
id: create_asset
run: |
cd bin
chmod u+x kind2
if [[ "$GITHUB_REF" =~ ^refs/tags/v.* ]]; then
vtag=$GITHUB_REF_NAME
echo "release=$GITHUB_REF_NAME" >> $GITHUB_OUTPUT
else
vtag=$(date "+%Y-%m-%d")
echo "release=nightly" >> $GITHUB_OUTPUT
fi
if [[ "$RUNNER_OS" == "Linux" ]]; then
ptag="linux-x86_64"
else
ptag="${{ matrix.os }}-$(uname -m)"
fi
tarball=kind2-$vtag-$ptag.tar.gz
tar -czf $tarball kind2
echo "filepath=./bin/$tarball" >> $GITHUB_OUTPUT
- name: Upload release asset
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ steps.create_asset.outputs.release }} \
${{ steps.create_asset.outputs.filepath }} \
--repo $GITHUB_REPOSITORY