1
0
mirror of https://github.com/privacyguides/privacyguides.org.git synced 2025-08-24 11:49:20 +00:00

Remove per-language config files (#2513)

This commit is contained in:
2024-04-10 15:18:32 -05:00
parent 1acdf1748f
commit 775ff52b14
27 changed files with 468 additions and 527 deletions

View File

@@ -1,79 +1,100 @@
# Copyright (c) 2024 Jonah Aragon <jonah@triplebit.net>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
name: 📦 PR Preview
on:
pull_request_target:
concurrency:
group: ${{github.event.pull_request.head.ref}}
cancel-in-progress: true
workflow_run:
workflows: [🛠️ Build PR Preview]
types:
- completed
permissions:
pull-requests: write
actions: read
contents: read
pull-requests: write
jobs:
submodule:
strategy:
matrix:
repo:
- name: mkdocs-material-insiders
ref: main
- name: brand
ref: main
- name: i18n
ref: main
uses: privacyguides/.github/.github/workflows/download-repo.yml@main
with:
repo: ${{ matrix.repo.name }}
secrets:
ACTIONS_SSH_KEY: ${{ secrets.ACTIONS_SSH_KEY }}
metadata:
if: >
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success'
build:
needs: submodule
strategy:
matrix:
lang: [es, fr, he, it, nl, ru, zh-Hant]
allow-error: [true]
include:
- lang: en
allow-error: false
fail-fast: false
permissions:
contents: read
uses: ./.github/workflows/build.yml
with:
ref: ${{github.event.pull_request.head.ref}}
repo: ${{github.event.pull_request.head.repo.full_name}}
lang: ${{ matrix.lang }}
continue-on-error: ${{ matrix.allow-error }}
runs-on: ubuntu-latest
outputs:
pr_number: ${{ steps.metadata.outputs.pr_number }}
sha: ${{ steps.metadata.outputs.sha }}
steps:
- name: Download Website Build Artifact
uses: actions/github-script@v7.0.1
with:
script: |
var artifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{github.event.workflow_run.id }},
});
var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == "site-build-combined"
})[0];
var download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
var fs = require('fs');
fs.writeFileSync('${{github.workspace}}/site-build-combined.zip', Buffer.from(download.data));
- name: Unpack Website
run: |
mkdir -p site
unzip site-build-combined.zip -d site
tar -czvf site-build-combined.tar.gz site
- name: Upload Combined Build Artifact
uses: actions/upload-artifact@v4
with:
name: site-build-combined.tar.gz
path: site-build-combined.tar.gz
retention-days: 5
- name: Download Metadata Artifact
uses: actions/github-script@v7.0.1
with:
script: |
var artifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{github.event.workflow_run.id }},
});
var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == "metadata"
})[0];
var download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
var fs = require('fs');
fs.writeFileSync('${{github.workspace}}/metadata.zip', Buffer.from(download.data));
- name: Set Metadata
id: metadata
run: |
mkdir -p metadata
unzip metadata.zip -d metadata
echo "pr_number=$(cat metadata/NR)" >> "$GITHUB_OUTPUT"
echo "sha=$(cat metadata/SHA)" >> "$GITHUB_OUTPUT"
deploy:
needs: build
needs: metadata
permissions:
contents: read
uses: privacyguides/webserver/.github/workflows/deploy-netlify-preview.yml@main
with:
netlify_alias: ${{ github.event.pull_request.head.sha }}
netlify_alias: ${{ needs.metadata.outputs.pr_number }}
netlify_site_id: ${{ vars.NETLIFY_SITE }}
secrets:
NETLIFY_TOKEN: ${{ secrets.NETLIFY_TOKEN }}
@@ -81,23 +102,19 @@ jobs:
comment:
permissions:
pull-requests: write
needs: deploy
needs: [deploy, metadata]
runs-on: ubuntu-latest
env:
address: ${{ needs.deploy.outputs.address }}
steps:
- uses: thollander/actions-comment-pull-request@v2.5.0
with:
pr_number: ${{ needs.metadata.outputs.pr_number }}
message: |
### <span aria-hidden="true">✅</span> Your preview is ready!
| Name | Link |
| :---: | ---- |
| <span aria-hidden="true">🔨</span> Latest commit | ${{ github.event.pull_request.head.sha }} |
| <span aria-hidden="true">🔨</span> Latest commit | ${{ needs.metadata.outputs.sha }} |
| <span aria-hidden="true">😎</span> Preview | ${{ env.address }} |
comment_tag: deployment
cleanup:
if: ${{ always() }}
needs: build
uses: privacyguides/.github/.github/workflows/cleanup.yml@main