From 6590ae9b13873653e87d54df4934291e352804fd Mon Sep 17 00:00:00 2001 From: Tobbe Lundberg Date: Tue, 10 Nov 2020 00:51:40 +0100 Subject: [PATCH 1/2] create_pr_package action --- .github/workflows/build-eslint-jest.yaml | 47 ----------------- .github/workflows/create_pr_package.yaml | 63 +++++++++++++++++++++++ .github/workflows/netlify-build.yaml | 21 -------- .github/workflows/publish-npm-canary.yaml | 46 ----------------- 4 files changed, 63 insertions(+), 114 deletions(-) delete mode 100644 .github/workflows/build-eslint-jest.yaml create mode 100644 .github/workflows/create_pr_package.yaml delete mode 100644 .github/workflows/netlify-build.yaml delete mode 100644 .github/workflows/publish-npm-canary.yaml diff --git a/.github/workflows/build-eslint-jest.yaml b/.github/workflows/build-eslint-jest.yaml deleted file mode 100644 index cf19b628bd34..000000000000 --- a/.github/workflows/build-eslint-jest.yaml +++ /dev/null @@ -1,47 +0,0 @@ -name: Lint, build and run tests - -on: - push: - branches: [main] - pull_request: - types: [opened, synchronize, reopened] - -jobs: - all: - strategy: - matrix: - os: ['ubuntu-latest', 'windows-latest'] - node-version: ['14', '12'] - fail-fast: true - runs-on: ${{ matrix.os }} - name: ${{ matrix.os }} | Node ${{ matrix.node-version }} latest - steps: - - uses: actions/checkout@v2 - - - name: Setup node - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - - name: Cache "node_modules" - uses: actions/cache@v2 - if: matrix.os == 'ubuntu-latest' - with: - path: '**/node_modules' - key: node_modules_${{ runner.os }}_${{ hashFiles('**/yarn.lock') }} - - - name: Install dependencies - run: yarn install --frozen-lockfile - - - name: Run ESLint - run: yarn lint - env: - CI: true - - - name: Build - run: yarn build - - - name: Run tests - run: yarn test - env: - CI: true diff --git a/.github/workflows/create_pr_package.yaml b/.github/workflows/create_pr_package.yaml new file mode 100644 index 000000000000..f0709e6de063 --- /dev/null +++ b/.github/workflows/create_pr_package.yaml @@ -0,0 +1,63 @@ +name: Create PR packages + +on: pull_request_target + +jobs: + create_pkg: + name: Create PR packages + runs-on: ubuntu-latest + defaults: + run: + shell: bash + + steps: + - name: Checkout PR + uses: actions/checkout@v2 + with: + ref: ${{ github.event.pull_request.head.sha }} + + - name: Setup node + uses: actions/setup-node@v1 + with: + node-version: 14 + + - name: Install dependencies + run: yarn install --frozen-lockfile + + - name: Build + run: yarn build + + - name: Create packages + run: | + mkdir bin + for d in packages/*/ ; do + (cd "$d" && tgz=$(npm pack) && cp $tgz ../../bin/) + done + + - name: copy files to s3 + env: + aws_key_id: ${{ secrets.AWS_KEY_ID }} + aws_secret_access_key: ${{ secrets.AWS_SECRET }} + run: | + sudo apt-get update && sudo apt-get -y install awscli + aws configure set aws_access_key_id $aws_key_id + aws configure set aws_secret_access_key $aws_secret_access_key + aws configure set default.region us-east-1 + aws s3 cp --recursive ./bin/ s3://rw-pr/${{ github.event.number }}/ + + - name: Create comment msg + id: comment_msg + run: | + msg="📦 Packages for this PR can be downloaded from%0A" + for p in bin/*; do + msg+="https://rw-pr.s3.amazonaws.com/${{ github.event.number }}/${p#bin/}%0A" + done + msg+="%0AInstall locally with yarn, e.g. \`yarn workspace web add \`" + echo "::set-output name=msg::$msg" + + - name: Comment on PR + uses: mshick/add-pr-comment@v1 + with: + message: ${{ steps.comment_msg.outputs.msg }} + repo-token: ${{ secrets.GITHUB_TOKEN }} + allow-repeats: false # The links don't change (but the file they link to does). So no need to repost diff --git a/.github/workflows/netlify-build.yaml b/.github/workflows/netlify-build.yaml deleted file mode 100644 index b58463fb5e95..000000000000 --- a/.github/workflows/netlify-build.yaml +++ /dev/null @@ -1,21 +0,0 @@ -name: Netlify deploy hook to add new docs on Redwoodjs.com - -on: - push: - branches: - - main - paths: - - '**.md' - release: - types: - - published - -jobs: - deploy_hook: - name: Starting Netlify Deploy - runs-on: ubuntu-latest - steps: - - name: POST build hook - run: | - set -e - curl -X POST https://api.netlify.com/build_hooks/5e72a1a0d832c03eb1f56934 diff --git a/.github/workflows/publish-npm-canary.yaml b/.github/workflows/publish-npm-canary.yaml deleted file mode 100644 index 7e425bc15d3c..000000000000 --- a/.github/workflows/publish-npm-canary.yaml +++ /dev/null @@ -1,46 +0,0 @@ -# TODO: Figure out how to make this workflow depend on the build, lint, test -# workflow. Then we don't have to double down on these run tasks. - -name: Publish canaray packages to npm - -on: - push: - branches: [main] - tags-ignore: - - v** - -jobs: - build: - if: github.repository == 'redwoodjs/redwood' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 # Required because lerna uses tags to determine the version. - - name: Setup node - uses: actions/setup-node@v1 - with: - node-version: '12' - - name: Print node and yarn versions - run: | - node --version - yarn --version - - name: Install dependencies - run: yarn install --frozen-lockfile --check-files - - name: Run ESLint - run: yarn lint - env: - CI: true - - name: Build - run: yarn build - - name: Run tests - run: yarn test - env: - CI: true - - name: Publish to npm - run: | - git fetch --depth=1 origin +refs/tags/*:refs/tags/* - echo "//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}" > .npmrc - ./tasks/publish-canary - env: - NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} From 79ef13568284e42365fc81f3b0f9f561aab1a646 Mon Sep 17 00:00:00 2001 From: Johan Eliasson Date: Wed, 11 Nov 2020 23:55:36 +0100 Subject: [PATCH 2/2] Testing PR build with @Tobbe --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dbd69b3be996..a543be73ecf6 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@

-

Redwood

+

Redwood is awesome

_by Tom Preston-Werner, Peter Pistorius, Rob Cameron, David Price, and more than a hundred amazing contributors (see end of file for a full list)._