chore: Release 0.23.0 (#196) #127
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
release-please: | |
name: Create Release | |
runs-on: ubuntu-latest | |
outputs: | |
release_created: ${{ steps.release.outputs.release_created }} | |
tag_name: ${{ steps.release.outputs.tag_name }} | |
steps: | |
- uses: google-github-actions/[email protected] | |
id: release | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
release-type: ocaml | |
package-name: binaryen.ml | |
pull-request-title-pattern: "chore${scope}: Release${component} ${version}" | |
bump-minor-pre-major: true | |
bump-patch-for-minor-pre-major: true | |
add-archive: | |
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 }} | |
notes: ${{ steps.upload.outputs.notes }} | |
steps: | |
- name: Install git-archive-all | |
run: | | |
brew install git-archive-all | |
- name: Checkout code | |
uses: actions/[email protected] | |
with: | |
submodules: "recursive" | |
- name: Build archive | |
run: | | |
git-archive-all --force-submodules binaryen-archive.tar.gz | |
- name: Upload Release Asset | |
id: upload | |
uses: grain-lang/[email protected] | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
file: ./binaryen-archive.tar.gz | |
asset_name: binaryen-archive-${{ needs.release-please.outputs.tag_name }}.tar.gz | |
tag: ${{ needs.release-please.outputs.tag_name }} | |
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 "[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 https://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 | |
env: | |
CHANGES: ${{ needs.add-archive.outputs.notes }} | |
run: | | |
echo -n "$CHANGES" > CHANGES.md | |
- name: Setup OCaml | |
uses: ocaml/setup-ocaml@v2 | |
with: | |
ocaml-compiler: 4.14.0 | |
# Version 2.1.0 of opam-publish doesn't respect OPAMYES=1 | |
# Ref https://github.com/ocaml-opam/opam-publish/issues/132#issuecomment-963616802 | |
- name: Install publish utils | |
run: | | |
opam install opam-publish=2.0.3 | |
- 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/[email protected] | |
with: | |
node-version: "16" | |
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 }} |