Skip to content

Commit

Permalink
Add a GitHub Action to generate the released archives
Browse files Browse the repository at this point in the history
  • Loading branch information
shym committed Jan 24, 2024
1 parent da20da9 commit 6b7810e
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Generate assets on releases

on:
release:
types:
- released

jobs:
assets:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: true

- name: Generate archives
env:
GH_TOKEN: ${{ github.token }}
run: |
tag="${GITHUB_REF#refs/tags/}"
git archive --prefix="ocaml-$tag/" @ >ocaml.tar
git -C winpthreads archive --prefix="ocaml-$tag/winpthreads/" @ >w.tar
cp ocaml.tar ocaml-winpthreads.tar
tar -A -f ocaml-winpthreads.tar w.tar
xz ocaml.tar
osha="$(sha256sum ocaml.tar.xz | awk '{print $1}')"
xz ocaml-winpthreads.tar
owsha="$(sha256sum ocaml-winpthreads.tar.xz | awk '{print $1}')"
gh release upload "$tag" "ocaml.tar.xz#ocaml.tar.xz ($osha)"
gh release upload "$tag" "ocaml-winpthreads.tar.xz#ocaml-winpthreads.tar.xz ($owsha)"

0 comments on commit 6b7810e

Please sign in to comment.