diff --git a/.gitattributes b/.gitattributes index 2071828c..d5246cd7 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,4 +1,2 @@ .github export-ignore .ocamlformat export-ignore -yarn.lock export-ignore -package.json export-ignore diff --git a/.github/workflows/esy.yml b/.github/workflows/esy.yml index 9f71bc01..43c7df07 100644 --- a/.github/workflows/esy.yml +++ b/.github/workflows/esy.yml @@ -1,4 +1,4 @@ -name: Binaryen.ml - esy workflow +name: Esy on: - push - pull_request diff --git a/.github/workflows/opam-publish.yml b/.github/workflows/opam-publish.yml deleted file mode 100644 index 35c31a8d..00000000 --- a/.github/workflows/opam-publish.yml +++ /dev/null @@ -1,57 +0,0 @@ -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-18.04] - 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 "bot@grain-lang.org" - 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/grainbot/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 - - - 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 --no-browser --msg-file=CHANGES.md ${{ github.event.release.assets[0].browser_download_url }} diff --git a/.github/workflows/opam.yml b/.github/workflows/opam.yml index c137fd95..27105d63 100644 --- a/.github/workflows/opam.yml +++ b/.github/workflows/opam.yml @@ -1,4 +1,4 @@ -name: Binaryen.ml - opam workflow +name: Opam on: - push - pull_request diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1ca00937..f5ff1edd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -name: Binaryen.ml Release +name: Release on: push: branches: @@ -12,6 +12,7 @@ jobs: release_created: ${{ steps.release.outputs.release_created }} upload_url: ${{ steps.release.outputs.upload_url }} tag_name: ${{ steps.release.outputs.tag_name }} + body: ${{ steps.release.outputs.body }} steps: - uses: GoogleCloudPlatform/release-please-action@v2 id: release @@ -22,10 +23,12 @@ jobs: bump-minor-pre-major: true add-archive: - needs: release-please + needs: [release-please] if: ${{ needs.release-please.outputs.release_created }} name: Add archive to release runs-on: macos-latest + outputs: + browser_download_url: ${{ steps.upload.outputs.browser_download_url }} steps: - name: Install git-archive-all run: | @@ -41,7 +44,7 @@ jobs: git-archive-all --force-submodules binaryen-archive.tar.gz - name: Upload Release Asset - id: upload-release-asset + id: upload uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -50,3 +53,60 @@ jobs: asset_path: ./binaryen-archive.tar.gz asset_name: binaryen-archive-${{ needs.release-please.outputs.tag_name }}.tar.gz asset_content_type: application/gzip + + opam-release: + needs: [release-please, add-archive] + name: Publish to opam registry + runs-on: ubuntu-latest + steps: + - name: Setup bot user + run: | + git config --global user.email "bot@grain-lang.org" + 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/grainbot/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 + + - name: Generate CHANGES file + run: | + echo -n "${{ needs.release-please.outputs.body }}" > CHANGES.md + + - name: Setup OCaml + uses: avsm/setup-ocaml@v1 + with: + ocaml-version: 4.11.1 + + - name: Install publish utils + run: | + opam install opam-publish + + - name: Publish to opam + run: | + opam publish --no-browser --msg-file=CHANGES.md ${{ needs.add-archive.outputs.browser_download_url }} + + npm-release: + needs: [add-archive] + name: Publish to npm registry + runs-on: ubuntu-latest + steps: + - name: Setup NodeJS + uses: actions/setup-node@v2 + with: + node-version: "14" + registry-url: "https://registry.npmjs.org" + + - name: Publish to npm + run: npm publish ${{ needs.add-archive.outputs.browser_download_url }} + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_RELEASE }}