chore: Update cache action (#111) #89
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: | |
- main | |
jobs: | |
release-please: | |
name: Create Release | |
runs-on: ubuntu-22.04 | |
outputs: | |
release_created: ${{ steps.release.outputs.release_created }} | |
tag_name: ${{ steps.release.outputs.tag_name }} | |
steps: | |
- uses: google-github-actions/release-please-action@v3.7.10 | |
id: release | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
release-type: ocaml | |
package-name: libbinaryen | |
pull-request-title-pattern: "chore${scope}: Release${component} ${version}" | |
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/checkout@v3.5.3 | |
with: | |
submodules: "recursive" | |
- name: Build archive | |
run: | | |
git-archive-all --force-submodules libbinaryen.tar.gz | |
- name: Upload Release Asset | |
id: upload | |
uses: grain-lang/upload-release-action@v3.0.2 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
file: ./libbinaryen.tar.gz | |
asset_name: libbinaryen-${{ 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-22.04 | |
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 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/libbinaryen.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 | |
- name: Install publish utils | |
run: | | |
opam install opam-publish=2.4.0 | |
- name: Publish to opam | |
run: | | |
opam publish --no-confirmation --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-22.04 | |
steps: | |
- name: Setup NodeJS | |
uses: actions/setup-node@v3.6.0 | |
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 }} |