Cleanup TODO for speculative authenticate #8618
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Website Preview | |
on: | |
pull_request_target: | |
types: | |
# not for "labeled" to prevent two builds for "labeled" and "unlabeled" when labels are changed | |
- unlabeled # if GitHub Actions stuck, add and remove "not ready" label to force rebuild | |
- opened | |
- reopened | |
- synchronize | |
# Do not run this workflow in parallel for any PR change | |
# to prevent concurrent pushes for the same Cloudflare domain alias. | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }} | |
cancel-in-progress: false | |
env: | |
GOPATH: /home/runner/go | |
GOCACHE: /home/runner/go/cache | |
GOLANGCI_LINT_CACHE: /home/runner/go/cache/lint | |
GOMODCACHE: /home/runner/go/mod | |
GOPROXY: https://proxy.golang.org | |
GOTOOLCHAIN: local | |
jobs: | |
blog-preview: | |
name: Preview blog | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 10 | |
if: > | |
contains(github.event.pull_request.labels.*.name, 'trust') && | |
!contains(github.event.pull_request.labels.*.name, 'not ready') && | |
(contains(github.event.pull_request.labels.*.name, 'blog/engineering') || | |
contains(github.event.pull_request.labels.*.name, 'blog/marketing')) | |
environment: | |
name: cloudflare-dev-blog | |
url: ${{ steps.extract.outputs.extracted_url }} | |
steps: | |
# TODO https://github.com/FerretDB/github-actions/issues/211 | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # for wrangler to work | |
lfs: true | |
ref: ${{ github.event.pull_request.head.sha }} | |
# for Wrangler / Cloudflare Pages on pull_request_target | |
- name: Name branch | |
env: | |
BRANCH: ${{ github.head_ref }} # see https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable | |
run: git checkout -b $BRANCH | |
# no ppremk/lfs-warning due to https://github.com/ppremk/lfs-warning/issues/150 | |
- name: Setup Go | |
uses: FerretDB/github-actions/setup-go@main | |
with: | |
cache-key: website-preview | |
- name: Install Task | |
run: go generate -x | |
working-directory: tools | |
- name: Build tools | |
run: bin/task env-pull | |
- name: Build blog | |
run: bin/task blog | |
- name: Check dirty | |
run: | | |
git status | |
git diff --exit-code | |
- name: Deploy to Cloudflare Pages | |
run: bin/task blog-cloudflare-preview | tee deploy.txt | |
env: | |
CLOUDFLARE_ACCOUNT_ID: ${{ vars.CLOUDFLARE_ACCOUNT_ID }} | |
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
- name: Set GitHub deployment URL | |
id: extract | |
uses: FerretDB/github-actions/extract-first-url@main | |
docs-preview: | |
name: Preview docs | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 10 | |
if: > | |
contains(github.event.pull_request.labels.*.name, 'trust') && | |
!contains(github.event.pull_request.labels.*.name, 'not ready') && | |
contains(github.event.pull_request.labels.*.name, 'documentation') | |
environment: | |
name: cloudflare-dev-docs | |
url: ${{ steps.extract.outputs.extracted_url }} | |
steps: | |
# We can't easily download build results from the Docs workflow: | |
# https://github.com/actions/download-artifact/issues/172 | |
# Just build them again instead. | |
# That also allows us to pass branch name, commit hash, etc from git to wrangler. | |
# TODO https://github.com/FerretDB/github-actions/issues/211 | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # for wrangler to work | |
lfs: true | |
ref: ${{ github.event.pull_request.head.sha }} # TODO https://github.com/FerretDB/github-actions/issues/211 | |
# for Wrangler / Cloudflare Pages on pull_request_target | |
- name: Name branch | |
env: | |
BRANCH: ${{ github.head_ref }} # see https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable | |
run: git checkout -b $BRANCH | |
# no ppremk/lfs-warning due to https://github.com/ppremk/lfs-warning/issues/150 | |
- name: Setup Go | |
uses: FerretDB/github-actions/setup-go@main | |
with: | |
cache-key: website-preview | |
- name: Install Task | |
run: go generate -x | |
working-directory: tools | |
- name: Build tools | |
run: bin/task env-pull | |
- name: Build docs | |
run: bin/task docs | |
- name: Check dirty | |
run: | | |
git status | |
git diff --exit-code | |
- name: Deploy to Cloudflare Pages | |
run: bin/task docs-cloudflare-preview | tee deploy.txt | |
env: | |
CLOUDFLARE_ACCOUNT_ID: ${{ vars.CLOUDFLARE_ACCOUNT_ID }} | |
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
- name: Set GitHub deployment URL | |
id: extract | |
uses: FerretDB/github-actions/extract-first-url@main |