-
Notifications
You must be signed in to change notification settings - Fork 5
115 lines (101 loc) · 3.72 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
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 }}