From 13d19f1a8929ff9cc8bf961fe9f4417c3a7d3dae Mon Sep 17 00:00:00 2001 From: Rosco Kalis Date: Thu, 13 Apr 2023 16:21:17 +0200 Subject: [PATCH] Split up release process into PR + release --- .github/workflows/create-update-pr.yml | 29 +++++++++++++++++++ .../{update.yml => publish-release.yml} | 22 ++++---------- 2 files changed, 35 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/create-update-pr.yml rename .github/workflows/{update.yml => publish-release.yml} (54%) diff --git a/.github/workflows/create-update-pr.yml b/.github/workflows/create-update-pr.yml new file mode 100644 index 0000000..f6e8041 --- /dev/null +++ b/.github/workflows/create-update-pr.yml @@ -0,0 +1,29 @@ +name: Create Update PR +on: + workflow_dispatch: + # Auto-update every week on midnight Monday + schedule: + - cron: '0 0 * * 1' +jobs: + update: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: 16.x + registry-url: 'https://registry.npmjs.org' + - name: Install dependencies + run: yarn + - name: Generate new files + run: yarn generate && yarn build + - name: Update version (major if there are deletions in enums.ts, otherwise minor) + run: git diff src/enums.ts | grep "^-[^-]" && yarn version --major --no-git-tag-version || yarn version --minor --no-git-tag-version + - name: Commit and create PR + uses: peter-evans/create-pull-request@v5 + with: + commit-message: Update chains based on latest data from chainId.network + title: Update chains based on latest data from chainId.network + body: Update chains based on latest data from chainId.network + branch: update-chains + delete-branch: true diff --git a/.github/workflows/update.yml b/.github/workflows/publish-release.yml similarity index 54% rename from .github/workflows/update.yml rename to .github/workflows/publish-release.yml index 4889b0d..e499f61 100644 --- a/.github/workflows/update.yml +++ b/.github/workflows/publish-release.yml @@ -1,9 +1,9 @@ -name: Update +name: Publish Release on: workflow_dispatch: - # Auto-update every week on midnight Monday - schedule: - - cron: '0 0 * * 1' + push: + branches: + - main jobs: update: runs-on: ubuntu-latest @@ -11,28 +11,18 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-node@v2 with: - node-version: '12.x' + node-version: 16.x registry-url: 'https://registry.npmjs.org' - name: Install dependencies run: yarn - - name: Generate new files - run: yarn generate && yarn build - - name: Update version (major if there are deletions in enums.ts, otherwise minor) - run: git diff src/enums.ts | grep "^-[^-]" && yarn version --major --no-git-tag-version || yarn version --minor --no-git-tag-version - - name: Commit and push changes - uses: EndBug/add-and-commit@v9 - with: - default_author: 'github_actions' - message: 'Update chains based on latest data from chainId.network' - name: Publish to npm - run: yarn publish + run: npm publish env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - name: Get package.json info id: package_json uses: jaywcjlove/github-action-package@main - name: Create Release - id: create_release uses: actions/create-release@latest env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}