undead404 deploys π #70
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
env: | |
PRODUCTION: true | |
name: Deploy | |
run-name: ${{ github.actor }} deploys π | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: main | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '21' | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
- name: Run lint | |
run: yarn lint | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: main | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '21' | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
- name: Run test | |
run: yarn test | |
build-interactive-examples: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
repository: webdoky/interactive-examples | |
ref: master | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '18' | |
- run: yarn install --frozen-lockfile | |
- run: yarn build | |
- uses: actions/upload-artifact@v4 | |
with: | |
if-no-files-found: error | |
name: interactive-examples | |
path: ./docs/ | |
build: | |
needs: [lint, test] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: main | |
- uses: actions/checkout@v4 | |
with: | |
repository: webdoky/content | |
ref: master | |
path: external/translated-content | |
- name: copy content | |
run: | | |
cp -r ./external/translated-content/files/uk ./src/content/processed-content | |
find ./src/content/processed-content -name "_*" -type d | while read -r dir; do mv "$dir" "$(dirname "$dir")/-`basename $dir`"; done | |
- uses: actions/checkout@v4 | |
with: | |
repository: mdn/content | |
ref: main | |
path: external/original-content | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '21' | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
- name: Renew data dependencies | |
run: yarn add @mdn/browser-compat-data@latest browser-specs@latest | |
- name: Run build | |
run: npx astro build | |
env: | |
BASE_PATH: ${{ vars.BASE_PATH }} | |
MODE: production | |
PATH_TO_LOCALIZED_CONTENT: ${{ vars.PATH_TO_LOCALIZED_CONTENT }} | |
PATH_TO_ORIGINAL_CONTENT: ${{ vars.PATH_TO_ORIGINAL_CONTENT }} | |
ROLLBAR_ACCESS_TOKEN: ${{ secrets.ROLLBAR_ACCESS_TOKEN }} | |
TARGET_LOCALE: ${{ vars.TARGET_LOCALE }} | |
GOOGLE_ANALYTICS_ID: ${{ vars.GOOGLE_ANALYTICS_ID }} | |
- run: sudo apt install rename | |
# Recursively replace all asterisks in folder names with "_asterisk_" | |
- run: find ./dist -depth -name "*" -execdir rename 's/\*/_asterisk_/g' "{}" \; | |
# Recursively replace all doublecolons in folder names with "_doublecolon_" | |
- run: find ./dist -depth -name "*" -execdir rename 's/::/_doublecolon_/g' "{}" \; | |
# Recursively replace all colons in folder names with "_colon_" | |
- run: find ./dist -depth -name "*" -execdir rename 's/:/_colon_/g' "{}" \; | |
# Recursively replace all asterisks in folder names with "_star_" | |
- run: find ./dist -depth -name "*" -execdir rename 's/\*/_star_/g' "{}" \; | |
- uses: actions/upload-artifact@v4 | |
with: | |
if-no-files-found: error | |
name: build | |
path: dist | |
deploy: | |
needs: [build, build-interactive-examples] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: build | |
path: dist | |
- run: sudo apt install rename | |
# Recursively replace all "_asterisk_" in folder names with asterisks | |
- run: find ./dist -depth -name "*_asterisk_*" -execdir rename 's/_asterisk_/*/g' "{}" \; | |
# Recursively replace all "_doublecolon_" in folder names with doublecolons | |
- run: find ./dist -depth -name "*_doublecolon_*" -execdir rename 's/_doublecolon_/::/g' "{}" \; | |
# Recursively replace all "_colon_" in folder names with colons | |
- run: find ./dist -depth -name "*_colon_*" -execdir rename 's/_colon_/:/g' "{}" \; | |
# Recursively replace all "_star_" in folder names with asterisks | |
- run: find ./dist -depth -name "*_star_*" -execdir rename 's/_star_/*/g' "{}" \; | |
- uses: actions/download-artifact@v4 | |
with: | |
name: interactive-examples | |
path: dist/interactive-examples | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '21' | |
- run: yarn global add surge | |
- run: npx surge ./dist --domain https://webdoky4.surge.sh | |
env: | |
SURGE_LOGIN: ${{ vars.SURGE_LOGIN }} | |
SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }} |