Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
12 changes: 10 additions & 2 deletions .github/workflows/android-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Android
on:
push:
branches:
- master
- main
pull_request:
jobs:
build:
Expand All @@ -15,6 +15,14 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Enable Corepack
run: corepack enable
# Corepack has to be enabled first, otherwise the cache step resolves the
# runner's global Yarn 1, which refuses to run this project.
- name: Restore Yarn cache
uses: actions/setup-node@v4
with:
node-version: 20
Expand All @@ -25,7 +33,7 @@ jobs:
distribution: temurin
java-version: 17
- name: Install npm dependencies
run: yarn --frozen-lockfile
run: yarn --immutable
shell: bash
- name: Build Android test app
uses: gradle/actions/setup-gradle@db19848a5fa7950289d3668fb053140cf3028d43 #v3.3.2
Expand Down
47 changes: 47 additions & 0 deletions .github/workflows/create-release-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Create Release Pull Request

on:
workflow_dispatch:
inputs:
base-branch:
description: 'The base branch for git operations and the pull request.'
default: 'main'
required: true
release-type:
description: 'A SemVer version diff, i.e. major, minor, or patch. Mutually exclusive with "release-version".'
required: false
type: choice
options:
- ''
- major
- minor
- patch
release-version:
description: 'A specific version to bump to. Mutually exclusive with "release-type".'
required: false

jobs:
create-release-pr:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout and setup environment
uses: MetaMask/action-checkout-and-setup@v3
with:
is-high-risk-environment: true
persist-credentials: false
# This is to guarantee that the most recent tag is fetched.
fetch-depth: 0
# We check out the specified branch, which will be used as the base
# branch for all git operations and the release PR.
ref: ${{ github.event.inputs.base-branch }}

- uses: MetaMask/action-create-release-pr@v5
with:
release-type: ${{ github.event.inputs.release-type }}
release-version: ${{ github.event.inputs.release-version }}
formatter: 'prettier'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
12 changes: 9 additions & 3 deletions .github/workflows/detox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,19 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Enable Corepack
run: corepack enable
# Corepack has to be enabled first, otherwise the cache step resolves the
# runner's global Yarn 1, which refuses to run this project.
- name: Restore Yarn cache
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'yarn'
- name: Setup - Install Yarn
run: YARN_GPG=NO curl -o- -L https://yarnpkg.com/install.sh | bash
- name: Setup - Install NPM Dependencies
run: yarn --frozen-lockfile
run: yarn --immutable
- name: Run tests
run: yarn ci
12 changes: 10 additions & 2 deletions .github/workflows/ios-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: iOS
on:
push:
branches:
- master
- main
pull_request:
jobs:
build:
Expand All @@ -14,12 +14,20 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Enable Corepack
run: corepack enable
# Corepack has to be enabled first, otherwise the cache step resolves the
# runner's global Yarn 1, which refuses to run this project.
- name: Restore Yarn cache
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'yarn'
- name: Install npm dependencies
run: yarn --frozen-lockfile
run: yarn --immutable
- name: Install Pods
run: ${{matrix.extraEnv}} pod install
working-directory: example/ios
Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Main

on:
push:
branches: [main]

permissions:
contents: read

jobs:
is-release:
# Filtering by `push` events ensures that we only release from the `main` branch, which is a
# requirement for our npm publishing environment.
# The commit author should always be 'github-actions' for releases created by the
# 'create-release-pr' workflow, so we filter by that as well to prevent accidentally
# triggering a release.
if: github.event_name == 'push' && startsWith(github.event.head_commit.author.name, 'github-actions')
outputs:
IS_RELEASE: ${{ steps.is-release.outputs.IS_RELEASE }}
runs-on: ubuntu-latest
steps:
- uses: MetaMask/action-is-release@v2
id: is-release

publish-release:
needs: is-release
if: needs.is-release.outputs.IS_RELEASE == 'true'
name: Publish release
permissions:
contents: write
id-token: write
uses: ./.github/workflows/publish-release.yml
secrets:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
93 changes: 68 additions & 25 deletions .github/workflows/publish-release.yml
Comment thread
joaoloureirop marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -1,70 +1,113 @@
name: Publish Release

on:
workflow_dispatch:
workflow_call:
secrets:
NPM_TOKEN:
required: false
SLACK_WEBHOOK_URL:
required: true

permissions:
contents: read

jobs:
publish-release:
permissions:
contents: write
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout and setup environment
uses: MetaMask/action-checkout-and-setup@v1
uses: MetaMask/action-checkout-and-setup@v3
with:
is-high-risk-environment: true
- uses: MetaMask/action-publish-release@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: yarn build
persist-credentials: false
ref: ${{ github.sha }}
# `prepare` also emits the type declarations into `lib`. Yarn 4 does not
# run it automatically at publish time, unlike Yarn 1.
- name: Build
run: yarn prepare
- name: Upload build artifacts
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: publish-release-artifacts-${{ github.sha }}
include-hidden-files: true
retention-days: 4
include-hidden-files: true
path: |
./packages/**/dist
./node_modules/.yarn-integrity
./lib
./node_modules/.yarn-state.yml

publish-npm-dry-run:
needs: publish-release
name: Publish to NPM (dry run)
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout and setup environment
uses: MetaMask/action-checkout-and-setup@v1
uses: MetaMask/action-checkout-and-setup@v3
with:
is-high-risk-environment: true
persist-credentials: false
ref: ${{ github.sha }}
skip-install: true
- name: Restore build artifacts
uses: actions/download-artifact@v4
uses: actions/download-artifact@v8
with:
name: publish-release-artifacts-${{ github.sha }}
- name: Dry Run Publish
# omit npm-token token to perform dry run publish
uses: MetaMask/action-npm-publish@v5
uses: MetaMask/action-npm-publish@v6
with:
dry-run: true
slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }}
subteam: S042S7RE4AE # @metamask-npm-publishers
env:
SKIP_PREPACK: true

publish-npm:
name: Publish to NPM
environment: npm-publish
runs-on: ubuntu-latest
needs: publish-npm-dry-run
runs-on: ubuntu-latest
environment: npm-publish
permissions:
contents: read
id-token: write
steps:
- name: Checkout and setup environment
uses: MetaMask/action-checkout-and-setup@v1
uses: MetaMask/action-checkout-and-setup@v3
with:
is-high-risk-environment: true
persist-credentials: false
ref: ${{ github.sha }}
skip-install: true
- name: Restore build artifacts
uses: actions/download-artifact@v4
uses: actions/download-artifact@v8
with:
name: publish-release-artifacts-${{ github.sha }}
- name: Publish to NPM
uses: MetaMask/action-npm-publish@v5
- name: Publish
uses: MetaMask/action-npm-publish@v6
with:
npm-token: ${{ secrets.NPM_TOKEN }}
dry-run: false
# This `NPM_TOKEN` needs to be manually set to publish a package for
# the first time only.
# Look in the repository settings under "Environments", and set this
# token in the `npm-publish` environment, and delete it after the
# initial publish.
npm-token: ${{ secrets.NPM_TOKEN }}
env:
SKIP_PREPACK: true

publish-release:
name: Publish to GitHub
needs: publish-npm
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout and setup environment
uses: MetaMask/action-checkout-and-setup@v3
with:
is-high-risk-environment: true
persist-credentials: false
ref: ${{ github.sha }}
skip-install: true
- uses: MetaMask/action-publish-release@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ node_modules/
npm-debug.log
yarn-error.log
package-lock.json
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

# Rubygem bundles
#
Expand Down
9 changes: 9 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-allow-scripts.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* eslint-disable */
//prettier-ignore
module.exports = {
name: "@yarnpkg/plugin-allow-scripts",
factory: function (require) {
var plugin=(()=>{var l=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var p=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(o,e)=>(typeof require<"u"?require:o)[e]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var u=(t,o)=>{for(var e in o)l(t,e,{get:o[e],enumerable:!0})},f=(t,o,e,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let i of a(o))!c.call(t,i)&&i!==e&&l(t,i,{get:()=>o[i],enumerable:!(r=s(o,i))||r.enumerable});return t};var m=t=>f(l({},"__esModule",{value:!0}),t);var g={};u(g,{default:()=>d});var n=p("@yarnpkg/shell"),x={hooks:{afterAllInstalled:async()=>{let t=await(0,n.execute)("yarn run allow-scripts");t!==0&&process.exit(t)}}},d=x;return m(g);})();
return plugin;
}
};
Loading
Loading