From 4aabbdf97b78a682f0cfeaa71115aa6f64bb465a Mon Sep 17 00:00:00 2001 From: Liam DeBeasi Date: Wed, 16 Nov 2022 12:35:25 -0500 Subject: [PATCH] chore(ci): nightly builds now run in parallel (#26301) --- .github/workflows/nightly.yml | 251 ++++++++++++++++++++++++++++------ 1 file changed, 210 insertions(+), 41 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 15f28ca526..c2203a3d46 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -7,54 +7,223 @@ on: - cron: '00 06 * * 1-5' jobs: - nightly-build: + create-nightly-hash: runs-on: ubuntu-latest + outputs: + nightly-hash: ${{ steps.create-nightly-hash.outputs.NIGHTLY_HASH }} steps: - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - uses: actions/setup-node@v3 - with: - node-version: 16 - - name: Install Dependencies - run: npm ci --no-package-lock && lerna bootstrap --ignore-scripts -- --legacy-peer-deps - shell: bash - - name: Prepare NPM Token - run: echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} > .npmrc - shell: bash - env: - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - - name: Configure Identity - run: | - git config user.name github-actions - git config user.email github-actions@github.com # A 1 is required before the timestamp # as lerna will fail when there is a leading 0 # See https://github.com/lerna/lerna/issues/2840 - - name: Create Nightly Hash + - name: Install Dependencies + run: npm ci --no-package-lock + shell: bash + - id: create-nightly-hash + name: Create Nightly Hash # The date should output YYYYMMDD # so that it is human readable run: | - echo "DATE=$(date +%Y%m%d)" >> $GITHUB_ENV - echo "CURRENT_VERSION=$(node ./.scripts/bump-version.js)" >> $GITHUB_ENV - shell: bash - - name: Checkout Nightly Branch - run: | - git checkout -b nightly-$(echo "${{ env.DATE }}") - git push origin nightly-$(echo "${{ env.DATE }}") - shell: bash - - name: Create Nightly Build - run: | - HUSKY_SKIP_HOOKS=1 lerna publish $(echo "${{ env.CURRENT_VERSION }}")-nightly.$(echo "${{ env.DATE }}") --no-verify-access --yes --force-publish='*' --dist-tag nightly --conventional-commits --conventional-prerelease --exact --create-release github - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - shell: bash - # We need to push the commit changes in order for the tags - # to get updated, but we don't need to keep the changelog - # changes around. - - name: Delete Nightly Branch - run: | - git checkout main - git branch -D nightly-$(echo "${{ env.DATE }}") - git push origin --delete nightly-$(echo "${{ env.DATE }}") + echo "NIGHTLY_HASH=$(node ./.scripts/bump-version.js)-nightly.$(date +%Y%m%d)" >> $GITHUB_OUTPUT shell: bash + release-core: + runs-on: ubuntu-latest + needs: [create-nightly-hash] + steps: + - uses: actions/checkout@v3 + - uses: ./.github/workflows/actions/release + with: + scope: '@ionic/core' + tag: nightly + version: ${{ needs.create-nightly-hash.outputs.nightly-hash }} + working-directory: 'core' + token: ${{ secrets.NPM_TOKEN }} + - name: Cache Built @ionic/core + uses: ./.github/workflows/actions/upload-archive + with: + name: ionic-core + output: core/CoreBuild.zip + paths: core/dist core/components core/css core/hydrate core/loader core/src/components.d.ts + - name: Cache Built @ionic/docs + uses: ./.github/workflows/actions/upload-archive + with: + name: ionic-docs + output: docs/DocsBuild.zip + paths: docs/core.json docs/core.d.ts + + release-docs: + needs: [create-nightly-hash, release-core] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Restore @ionic/docs built cache + uses: ./.github/workflows/actions/download-archive + with: + name: ionic-docs + path: ./docs + filename: DocsBuild.zip + - uses: ./.github/workflows/actions/release + with: + scope: '@ionic/docs' + tag: nightly + version: ${{ needs.create-nightly-hash.outputs.nightly-hash }} + working-directory: 'docs' + token: ${{ secrets.NPM_TOKEN }} + + release-angular: + needs: [create-nightly-hash, release-core] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Restore @ionic/core built cache + uses: ./.github/workflows/actions/download-archive + with: + name: ionic-core + path: ./core + filename: CoreBuild.zip + - uses: ./.github/workflows/actions/release + with: + scope: '@ionic/angular' + tag: nightly + version: ${{ needs.create-nightly-hash.outputs.nightly-hash }} + working-directory: 'angular' + folder: './dist' + token: ${{ secrets.NPM_TOKEN }} + - name: Cache Built @ionic/angular + uses: ./.github/workflows/actions/upload-archive + with: + name: ionic-angular + output: ./angular/AngularBuild.zip + paths: ./angular/dist + + release-react: + needs: [create-nightly-hash, release-core] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Restore @ionic/core built cache + uses: ./.github/workflows/actions/download-archive + with: + name: ionic-core + path: ./core + filename: CoreBuild.zip + - uses: ./.github/workflows/actions/release + with: + scope: '@ionic/react' + tag: nightly + version: ${{ needs.create-nightly-hash.outputs.nightly-hash }} + working-directory: 'packages/react' + token: ${{ secrets.NPM_TOKEN }} + - name: Cache Built @ionic/react + uses: ./.github/workflows/actions/upload-archive + with: + name: ionic-react + output: packages/react/ReactBuild.zip + paths: packages/react/dist packages/react/css + + release-vue: + needs: [create-nightly-hash, release-core] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Restore @ionic/core built cache + uses: ./.github/workflows/actions/download-archive + with: + name: ionic-core + path: ./core + filename: CoreBuild.zip + - uses: ./.github/workflows/actions/release + with: + scope: '@ionic/vue' + tag: nightly + version: ${{ needs.create-nightly-hash.outputs.nightly-hash }} + working-directory: 'packages/vue' + token: ${{ secrets.NPM_TOKEN }} + - name: Cache Built @ionic/vue + uses: ./.github/workflows/actions/upload-archive + with: + name: ionic-vue + output: packages/vue/VueBuild.zip + paths: packages/vue/dist packages/vue/css + + release-angular-server: + needs: [create-nightly-hash, release-angular] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Restore @ionic/angular built cache + uses: ./.github/workflows/actions/download-archive + with: + name: ionic-angular + path: ./angular + filename: AngularBuild.zip + - uses: ./.github/workflows/actions/release + with: + scope: '@ionic/angular-server' + tag: nightly + version: ${{ needs.create-nightly-hash.outputs.nightly-hash }} + working-directory: 'packages/angular-server' + folder: './dist' + token: ${{ secrets.NPM_TOKEN }} + + release-react-router: + needs: [create-nightly-hash, release-react] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Restore @ionic/react built cache + uses: ./.github/workflows/actions/download-archive + with: + name: ionic-react + path: ./packages/react + filename: ReactBuild.zip + - uses: ./.github/workflows/actions/release + with: + scope: '@ionic/react-router' + tag: nightly + version: ${{ needs.create-nightly-hash.outputs.nightly-hash }} + working-directory: 'packages/react-router' + token: ${{ secrets.NPM_TOKEN }} + + release-vue-router: + needs: [create-nightly-hash, release-vue] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Restore @ionic/vue built cache + uses: ./.github/workflows/actions/download-archive + with: + name: ionic-vue + path: ./packages/vue + filename: VueBuild.zip + - uses: ./.github/workflows/actions/release + with: + scope: '@ionic/vue-router' + tag: nightly + version: ${{ needs.create-nightly-hash.outputs.nightly-hash }} + working-directory: 'packages/vue-router' + token: ${{ secrets.NPM_TOKEN }} + + finalize-release: + needs: [create-nightly-hash, release-core, release-angular, release-react, release-vue, release-docs, release-angular-server, release-vue-router, release-react-router] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + token: ${{ secrets.IONITRON_TOKEN }} + fetch-depth: 0 + - name: Configure Identity + # Commits from github-actions do not + # trigger other GitHub Actions. As a result, + # we publish releases from Ionitron instead + # so actions run when merging the release branch + # back into main. + run: | + git config user.name ionitron + git config user.email hi@ionicframework.com + shell: bash + - name: Create GitHub Release + run: lerna version ${{ inputs.version }} --yes --force-publish='*' --conventional-commits --conventional-prerelease --create-release github + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + shell: bash