Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/manual-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Manual Release
# Triggers a merge from main->release, which will then trigger a release
# from the release branch.
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
merge-to-release-branch:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Merge main -> release
uses: devmasx/merge-branch@master
with:
type: now
from_branch: main
target_branch: release
github_token: ${{ secrets.MOMENTO_MACHINE_USER_GITHUB_TOKEN }}
25 changes: 25 additions & 0 deletions .github/workflows/on-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: on-pull-request
on:
pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Install Node
uses: actions/setup-node@v3
with:
node-version: 18
cache: npm

- name: Install dependencies
run: npm install

- name: Build
run: npm run build

# TODO: verify readme generation
24 changes: 24 additions & 0 deletions .github/workflows/on-push-to-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: On push to main branch
on:
push:
branches: [main]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Install Node
uses: actions/setup-node@v3
with:
node-version: 18
cache: npm

- name: Install dependencies
run: npm install

- name: Build
run: npm run build

# TODO: generate and commit readme
60 changes: 60 additions & 0 deletions .github/workflows/on-push-to-release-branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: On push to release branch

on:
push:
branches: [ release ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
release:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.release.outputs.release }}
steps:
- uses: actions/checkout@v3

- name: Set release
id: semrel
uses: go-semantic-release/action@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
allow-initial-development-versions: true
force-bump-patch-version: true
# For whatever reason, this silly tool won't let you do releases from branches
# other than the default branch unless you pass this flag, which doesn't seem
# to actually have anything to do with CI:
# https://github.com/go-semantic-release/semantic-release/blob/master/cmd/semantic-release/main.go#L173-L194
# https://github.com/go-semantic-release/condition-github/blob/4c8af3fc516151423fff2f77eb08bf7082570676/pkg/condition/github.go#L42-L44
custom-arguments: '--no-ci'

- name: Output release
id: release
run: echo "::set-output name=release::${{ steps.semrel.outputs.version }}"

publish_javascript:
runs-on: ubuntu-latest
needs: release
steps:
- uses: actions/checkout@v3

- name: Install Node
uses: actions/setup-node@v3
with:
node-version: 18
registry-url: 'https://registry.npmjs.org'

- name: Build all packages
run: |
npm ci
npm run build

- name: Publish package to npm
run: |
export VERSION="${{ needs.release.outputs.version }}"
echo "Publishing package with version $VERSION"
mv package.json package.json.ORIG
cat package.json.ORIG|jq ". += {\"version\": \"$VERSION\"}" > package.json
npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}