diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 318bae1f13..0000000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,114 +0,0 @@ -name: build - -on: - # Run on PRs and pushes to the default branch. - push: - branches: - - main - pull_request: - branches: - - main - schedule: - - cron: "0 0 * * 0" - -# Declare default permissions as read only. -permissions: read-all - -env: - # Keep for Dart SDK reporting - PUB_ENVIRONMENT: bot.github - # LTS - NODE_VERSION: '20' - # Tool location - BASE_DIR: ${{ github.workspace }} - TOOL_DIR: ${{ github.workspace }}/tool - -jobs: - - test: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - include: -# - sdk: dev -# experimental: false - - sdk: beta - experimental: false - - sdk: stable - experimental: false - continue-on-error: ${{ matrix.experimental }} - steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - with: - submodules: recursive - - uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d - with: - sdk: ${{ matrix.sdk }} - - run: dart pub get - - run: tool/test.sh - env: - DART_CHANNEL: ${{ matrix.sdk }} - - deploy: - permissions: - checks: write - pull-requests: write - if: ${{ github.event_name == 'push' && - github.ref == 'refs/heads/main' && - github.repository == 'dart-lang/site-www' }} - needs: test - runs-on: ubuntu-latest - env: - FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }} - FIREBASE_PROJECT: default - steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - with: - submodules: recursive - - run: make build - - run: make write-prod-robots - - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 - with: - node-version: ${{ env.NODE_VERSION }} - - run: npm install -g firebase-tools@12.8.1 - - uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d - with: - sdk: stable - - run: tool/check-links.sh - - uses: FirebaseExtended/action-hosting-deploy@120e124148ab7016bec2374e5050f15051255ba2 - with: - repoToken: '${{ secrets.GITHUB_TOKEN }}' - firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_DART_DEV }}' - projectId: dart-dev - channelId: live - - stage: - permissions: - contents: read - checks: write - pull-requests: write - if: ${{ github.ref != 'refs/heads/main' }} - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - with: - submodules: recursive - - run: make build - - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 - with: - node-version: ${{ env.NODE_VERSION }} - - run: npm install -g firebase-tools@12.8.1 - - uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d - with: - sdk: stable - - run: tool/check-links.sh - - name: Stage site on Firebase - if: ${{ - github.event.pull_request.head.repo.full_name == github.repository && - github.event.pull_request.user.login != 'dependabot[bot]' }} - uses: FirebaseExtended/action-hosting-deploy@120e124148ab7016bec2374e5050f15051255ba2 - with: - repoToken: '${{ secrets.GITHUB_TOKEN }}' - firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_DART_DEV }}' - projectId: dart-dev diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000000..1db2b5aa21 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,54 @@ +name: deploy + +on: + # Run on pushes to the default branch. + push: + branches: + - main + schedule: + - cron: "0 0 * * 0" + +# Declare default permissions as read only. +permissions: read-all + +env: + # Keep for Dart SDK reporting + PUB_ENVIRONMENT: bot.github + # LTS + NODE_VERSION: '20' + # Tool location + BASE_DIR: ${{ github.workspace }} + TOOL_DIR: ${{ github.workspace }}/tool + +jobs: + deploy: + name: Deploy production site to Firebase hosting + permissions: + checks: write + pull-requests: write + if: ${{ github.event_name == 'push' && + github.ref == 'refs/heads/main' && + github.repository == 'dart-lang/site-www' }} + runs-on: ubuntu-latest + env: + FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }} + FIREBASE_PROJECT: default + steps: + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + with: + submodules: recursive + - run: make build + - run: make write-prod-robots + - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 + with: + node-version: ${{ env.NODE_VERSION }} + - run: npm install -g firebase-tools@13.0.2 + - uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d + with: + sdk: stable + - uses: FirebaseExtended/action-hosting-deploy@120e124148ab7016bec2374e5050f15051255ba2 + with: # TODO(khanhnwin/drewroen): Migrate deploy to Cloud Build + repoToken: '${{ secrets.GITHUB_TOKEN }}' + firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_DART_DEV }}' + projectId: dart-dev + channelId: live diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000000..fa0f802f72 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,66 @@ +name: test + +on: + # Run on PRs and pushes to the default branch. + push: + branches: + - main + pull_request: + branches: + - main + schedule: + - cron: "0 0 * * 0" + +# Declare default permissions as read only. +permissions: read-all + +env: + # Keep for Dart SDK reporting + PUB_ENVIRONMENT: bot.github + # LTS + NODE_VERSION: '20' + # Tool location + BASE_DIR: ${{ github.workspace }} + TOOL_DIR: ${{ github.workspace }}/tool + +jobs: + test: + name: Check excerpts and run tests + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - sdk: beta + experimental: false + - sdk: stable + experimental: false + continue-on-error: ${{ matrix.experimental }} + steps: + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + with: + submodules: recursive + - uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d + with: + sdk: ${{ matrix.sdk }} + - run: dart pub get + - run: tool/test.sh + env: + DART_CHANNEL: ${{ matrix.sdk }} + + linkcheck: + name: Build site and check links + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + with: + submodules: recursive + - run: make build + - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 + with: + node-version: ${{ env.NODE_VERSION }} + - run: npm install -g firebase-tools@13.0.2 + - uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d + with: + sdk: stable + - run: tool/check-links.sh diff --git a/Dockerfile b/Dockerfile index f3c1fde6c3..beeb749d1e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -101,7 +101,7 @@ RUN BUNDLE_WITHOUT="test production" bundle install --jobs=4 --retry=2 ENV NODE_ENV=development COPY package.json package-lock.json ./ -RUN npm install -g firebase-tools@12.8.1 +RUN npm install -g firebase-tools@13.0.2 RUN npm install COPY ./ ./ @@ -159,7 +159,7 @@ RUN bundle exec jekyll build --config $BUILD_CONFIGS # ============== DEPLOY to FIREBASE ============== FROM build as deploy -RUN npm install -g firebase-tools@12.8.1 +RUN npm install -g firebase-tools@13.0.2 ARG FIREBASE_TOKEN ENV FIREBASE_TOKEN=$FIREBASE_TOKEN ARG FIREBASE_PROJECT=default