feat: externalize script to fetch contributors #671
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: CD | |
on: | |
workflow_dispatch: ~ | |
push: | |
branches: | |
- main | |
- staging | |
# Deploy if "deploy" label exists | |
pull_request: | |
types: [reopened, synchronize, labeled] | |
# Do not use concurrency to prevent simultaneous helm deployments | |
jobs: | |
remove-deploy-label: | |
name: Remove deploy label | |
if: github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'deploy') | |
runs-on: ubuntu-latest | |
steps: | |
- uses: mondeja/remove-labels-gh-action@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
labels: | | |
deploy | |
storage: | |
name: Put data in storage | |
runs-on: ubuntu-latest | |
if: github.event_name != 'pull_request' || (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'deploy')) | |
permissions: | |
contents: "read" | |
id-token: "write" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
# gcloud does not work with Python 3.10 because collections.Mappings was removed in Python 3.10. | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9.15 | |
- name: Auth gcloud | |
uses: google-github-actions/auth@v1 | |
with: | |
credentials_json: ${{ secrets.gke-credentials }} | |
- name: Setup gcloud | |
uses: google-github-actions/setup-gcloud@v1 | |
with: | |
project_id: ${{ secrets.gke-project }} | |
- name: Store contributors | |
run: | | |
pnpm contributors | |
gsutils -q -m rsync -d -r ./data/contributors.json gs://api-platform-website-v3/ | |
build: | |
name: Build | |
if: github.event_name != 'pull_request' || (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'deploy')) | |
uses: ./.github/workflows/build.yml | |
with: | |
tags: | | |
type=ref,event=pr,prefix=pr-,priority=1000 | |
type=edge,branch=$repo.default_branch,priority=900 | |
type=raw,value=latest,enable={{is_default_branch}},priority=900 | |
push: true | |
gke-cluster: api-platform-demo | |
gke-zone: europe-west1-c | |
secrets: | |
gke-credentials: ${{ secrets.GKE_SA_KEY }} | |
gke-project: ${{ secrets.GKE_PROJECT }} | |
gh-key: ${{ secrets.GH_KEY }} | |
deploy: | |
name: Deploy | |
needs: [build] | |
if: github.event_name != 'pull_request' || (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'deploy')) | |
uses: ./.github/workflows/deploy.yml | |
with: | |
environment: prod | |
docker-images-version: ${{ github.sha }} | |
gke-cluster: api-platform-demo | |
gke-zone: europe-west1-c | |
secrets: | |
gke-credentials: ${{ secrets.GKE_SA_KEY }} | |
gke-project: ${{ secrets.GKE_PROJECT }} | |
gh-key: ${{ secrets.GH_KEY }} | |
# cloudflare-api-token: ${{ secrets.CF_API_TOKEN }} | |
# cloudflare-zone-id: ${{ secrets.CF_ZONE_ID }} |