diff --git a/.github/workflows/create-release-pr.yml b/.github/workflows/create-release-pr.yml deleted file mode 100644 index 681ce6cb..00000000 --- a/.github/workflows/create-release-pr.yml +++ /dev/null @@ -1,41 +0,0 @@ -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 - 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: - - uses: actions/checkout@v3 - with: - # This is to guarantee that the most recent tag is fetched. - # This can be configured to a more reasonable value by consumers. - 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 }} - - name: Setup Node.js - uses: actions/setup-node@v3 - with: - node-version-file: '.nvmrc' - - uses: MetaMask/action-create-release-pr@v2 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - release-type: ${{ github.event.inputs.release-type }} - release-version: ${{ github.event.inputs.release-version }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5bac45e6..6473a885 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -48,29 +48,3 @@ jobs: if [[ $passed != "true" ]]; then exit 1 fi - - 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') - needs: all-jobs-pass - 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: - needs: is-release - if: needs.is-release.outputs.IS_RELEASE == 'true' - name: Publish release - permissions: - contents: write - uses: ./.github/workflows/publish-release.yml - secrets: - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - PUBLISH_SITE_TOKEN: ${{ secrets.PUBLISH_SITE_TOKEN }} diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml deleted file mode 100644 index f1c2aea7..00000000 --- a/.github/workflows/publish-release.yml +++ /dev/null @@ -1,88 +0,0 @@ -name: Publish Release - -on: - workflow_call: - secrets: - NPM_TOKEN: - required: true - PUBLISH_SITE_TOKEN: - required: true - -jobs: - publish-release: - permissions: - contents: write - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - ref: ${{ github.sha }} - - name: Setup Node.js - uses: actions/setup-node@v3 - 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: | - ./packages/*/dist - ./node_modules/.yarn-state.yml - key: ${{ github.sha }} - - publish-npm-dry-run: - runs-on: ubuntu-latest - needs: publish-release - steps: - - uses: actions/checkout@v3 - with: - ref: ${{ github.sha }} - - uses: actions/cache@v3 - id: restore-build - with: - path: | - ./packages/*/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@v4 - - publish-npm: - environment: npm-publish - runs-on: ubuntu-latest - needs: publish-npm-dry-run - steps: - - uses: actions/checkout@v3 - with: - ref: ${{ github.sha }} - - uses: actions/cache@v3 - id: restore-build - with: - path: | - ./packages/*/dist - ./node_modules/.yarn-state.yml - key: ${{ github.sha }} - - name: Publish - uses: MetaMask/action-npm-publish@v2 - 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 }} - - publish-release-to-gh-pages: - needs: publish-npm - name: Publish site to `gh-pages` branch - permissions: - contents: write - uses: ./.github/workflows/publish-site.yml - with: - destination_dir: . - secrets: - PUBLISH_SITE_TOKEN: ${{ secrets.PUBLISH_SITE_TOKEN }} diff --git a/.github/workflows/publish-site.yml b/.github/workflows/publish-site.yml deleted file mode 100644 index 389808ff..00000000 --- a/.github/workflows/publish-site.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: Publish site to GitHub Pages - -on: - workflow_call: - inputs: - destination_dir: - required: true - type: string - secrets: - PUBLISH_SITE_TOKEN: - required: true - -jobs: - publish-site-to-gh-pages: - name: Publish site to GitHub Pages - runs-on: ubuntu-latest - environment: github-pages - permissions: - contents: write - steps: - - name: Ensure `destination_dir` is not empty - if: ${{ inputs.destination_dir == '' }} - run: exit 1 - - name: Checkout the repository - uses: actions/checkout@v3 - - name: Use Node.js - uses: actions/setup-node@v3 - with: - node-version-file: '.nvmrc' - cache: 'yarn' - - name: Install npm dependencies - run: yarn --immutable - - name: Run build script - run: yarn workspace site run build - - name: Deploy to `${{ inputs.destination_dir }}` directory of `gh-pages` branch - uses: peaceiris/actions-gh-pages@de7ea6f8efb354206b205ef54722213d99067935 - with: - # This `PUBLISH_SITE_TOKEN` needs to be manually set per-repository. - # Look in the repository settings under "Environments", and set this token in the `github-pages` environment. - personal_token: ${{ secrets.PUBLISH_SITE_TOKEN }} - publish_dir: ./packages/site/public - destination_dir: ${{ inputs.destination_dir }} diff --git a/scripts/cleanup.sh b/scripts/cleanup.sh index 1a132686..5a37fad2 100755 --- a/scripts/cleanup.sh +++ b/scripts/cleanup.sh @@ -4,8 +4,5 @@ set -u set -o pipefail rm .github/CODEOWNERS -rm .github/workflows/create-release-pr.yml -rm .github/workflows/publish-release.yml -rm .github/workflows/publish-site.yml rm -f scripts/cleanup.sh git commit -am "Clean up undesired MetaMask GitHub files"