Skip to content

Commit

Permalink
Merge pull request #27 from grain-lang/opam-publish-headless
Browse files Browse the repository at this point in the history
Add workflow for automatic opam publish
  • Loading branch information
phated authored Sep 9, 2020
2 parents 335e685 + e2fb4da commit 71eaf20
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 1 deletion.
62 changes: 62 additions & 0 deletions .github/workflows/opam-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Binaryen.ml - publish to opam
on:
release:
types: [released]

jobs:
build:
name: Publish to opam
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
ocaml-version: [4.10.0]

steps:
- name: Checkout project
uses: actions/checkout@v2
with:
submodules: 'recursive'

- name: Setup bot user
run: |
git config --global user.email "[email protected]"
git config --global user.name "Grain Bot"
# Some hacks to make sure opam doesn't pull the repo in a way we can't deal with
- name: Setup opam repository
run: |
mkdir -p ~/.opam/plugins/opam-publish/repos/
git clone git://github.com/ocaml/opam-repository ~/.opam/plugins/opam-publish/repos/ocaml%opam-repository
cd ~/.opam/plugins/opam-publish/repos/ocaml%opam-repository
git remote add user https://${{ secrets.OPAM_RELEASE }}@github.com/grain-lang/opam-repository
# Set up our token because opam doesn't support env var tokens
- name: Setup token
run: |
mkdir -p ~/.opam/plugins/opam-publish/
echo -n ${{ secrets.OPAM_RELEASE }} > ~/.opam/plugins/opam-publish/binaryen.token
# This is the only way to make opam publish "headless" currently
- name: Remove xdg-open
run: |
sudo rm $(which xdg-open)
- name: Generate CHANGES file
run: |
echo -n "${{ github.event.release.body }}" > CHANGES.md
- name: Setup OCaml ${{ matrix.ocaml-version }}
uses: avsm/setup-ocaml@v1
with:
ocaml-version: ${{ matrix.ocaml-version }}

- name: Install local dependencies
run: |
opam install opam-publish
- name: Publish to opam
run: |
opam publish --msg-file=CHANGES.md ${{ github.event.release.assets[0].browser_download_url }}
2 changes: 2 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ jobs:

- name: Checkout code
uses: actions/checkout@v2
with:
submodules: 'recursive'

- name: Build archive
run: |
Expand Down
2 changes: 2 additions & 0 deletions binaryen.opam
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
opam-version: "2.0"
version: "0.3.0"
synopsis: "OCaml bindings for Binaryen"
maintainer: "[email protected]"
author: "Oscar Spencer"
license: " Apache-2.0"
homepage: "https://github.com/grain-lang/binaryen.ml"
dev-repo: "git+https://github.com/grain-lang/binaryen.ml.git"
bug-reports: "https://github.com/grain-lang/binaryen.ml/issues"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "binaryen.ml",
"version": "0.2.2",
"version": "0.3.0",
"description": "OCaml bindings for Binaryen.",
"author": "Oscar Spencer <[email protected]>",
"license": "Apache-2.0",
Expand Down

0 comments on commit 71eaf20

Please sign in to comment.