-
Notifications
You must be signed in to change notification settings - Fork 4
chore: add ci/cd workflows #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| 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 }} |
This file contains hidden or 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
| 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 |
This file contains hidden or 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
| 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 |
This file contains hidden or 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
| 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 }} | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.