remove sessionProperties, switch requiredScopes to optionalScopes (#285) #162
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: Publish Release | |
on: | |
push: | |
branches: [main] | |
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@v1 | |
id: is-release | |
publish-release: | |
permissions: | |
contents: write | |
needs: is-release | |
if: needs.is-release.outputs.IS_RELEASE == 'true' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.sha }} | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: ".nvmrc" | |
- uses: MetaMask/action-publish-release@v3 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install | |
run: | | |
yarn install | |
yarn build | |
- uses: actions/cache@v3 | |
id: restore-build | |
with: | |
path: | | |
./dist | |
./node_modules/.yarn-state.yml | |
key: ${{ github.sha }} | |
publish-npm-dry-run: | |
runs-on: ubuntu-latest | |
needs: publish-release | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.sha }} | |
- uses: actions/cache@v3 | |
id: restore-build | |
with: | |
path: | | |
./dist | |
./node_modules/.yarn-state.yml | |
key: ${{ github.sha }} | |
- name: Dry Run Publish | |
# omit npm-token token to perform dry run publish | |
uses: MetaMask/action-npm-publish@v1 | |
env: | |
SKIP_PREPACK: true | |
publish-npm: | |
environment: npm-publish | |
runs-on: ubuntu-latest | |
needs: publish-npm-dry-run | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.sha }} | |
- uses: actions/cache@v3 | |
id: restore-build | |
with: | |
path: | | |
./dist | |
./node_modules/.yarn-state.yml | |
key: ${{ github.sha }} | |
- name: Publish | |
uses: MetaMask/action-npm-publish@v1 | |
with: | |
# This `NPM_TOKEN` needs to be manually set per-repository. | |
# Look in the repository settings under "Environments", and set this token in the `npm-publish` environment. | |
npm-token: ${{ secrets.NPM_TOKEN }} | |
env: | |
SKIP_PREPACK: true | |
get-release-version: | |
runs-on: ubuntu-latest | |
needs: publish-npm | |
outputs: | |
RELEASE_VERSION: ${{ steps.get-release-version.outputs.RELEASE_VERSION }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.sha }} | |
- id: get-release-version | |
shell: bash | |
run: ./scripts/get.sh ".version" "RELEASE_VERSION" | |
publish-release-to-gh-pages: | |
needs: get-release-version | |
name: Publish docs to `${{ needs.get-release-version.outputs.RELEASE_VERSION }}` directory of `gh-pages` branch | |
permissions: | |
contents: write | |
uses: ./.github/workflows/publish-docs.yml | |
with: | |
destination_dir: ${{ needs.get-release-version.outputs.RELEASE_VERSION }} | |
secrets: | |
PUBLISH_DOCS_TOKEN: ${{ secrets.PUBLISH_DOCS_TOKEN }} | |
publish-release-to-latest-gh-pages: | |
needs: publish-npm | |
name: Publish docs to `latest` directory of `gh-pages` branch | |
permissions: | |
contents: write | |
uses: ./.github/workflows/publish-docs.yml | |
with: | |
destination_dir: latest | |
secrets: | |
PUBLISH_DOCS_TOKEN: ${{ secrets.PUBLISH_DOCS_TOKEN }} |