Skip to content

Commit

Permalink
Migrate to GHA from publisher
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderBelokon committed Jan 6, 2025
1 parent 2a356c7 commit a18fd4d
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 10 deletions.
9 changes: 0 additions & 9 deletions .artifacts.yml

This file was deleted.

31 changes: 31 additions & 0 deletions .github/workflows/basic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Basic Tests

on:
pull_request:

jobs:
prepare:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: npm

- name: Configure AWS Credentials
uses: mapbox/configure-aws-credentials-internal@v5
with:
target-account-id: ${{ vars.AWS_ACCOUNT_ID_DEFAULT }}

- name: Retrieve and configure npm token
uses: mapbox/setup-npm-token@v2

- name: Install npm dependencies
run: npm ci --no-fund --no-audit --prefer-offline

- name: Test
run: npm test
52 changes: 52 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Deploy

on:
push:
branches: [staging, production]

env:
bucket: '{ "staging": "labs.mapbox.com-staging/assembly", "production": "labs.mapbox.com/assembly" }'

jobs:
deploy:
name: Deploy to ${{ matrix.environment }}
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
strategy:
matrix:
environment: [staging, production]
exclude:
- environment: ${{ github.ref_name != 'staging' && 'staging' }}
- environment: ${{ github.ref_name != 'production' && 'production' }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: npm

- name: Configure AWS Credentials
uses: mapbox/configure-aws-credentials-internal@v5
with:
target-account-id: ${{ vars.AWS_ACCOUNT_ID_DEFAULT }}

- name: Retrieve and configure npm token
uses: mapbox/setup-npm-token@v2

- name: Install npm dependencies
run: npm ci --no-fund --no-audit --prefer-offline

- name: Build for ${{ matrix.environment }}
run: npm run build

- name: Sync files ${{ matrix.environment }}
run: aws s3 sync _site ${{ env.targetBucket }} --exclude "*.html" --exclude "*.xml" --cache-control "max-age=31536000"
env:
targetBucket: s3://${{ fromJson(env.bucket)[matrix.environment] }}

- name: Sync html files to ${{ matrix.environment }}
run: aws s3 sync _site ${{ env.targetBucket }} --exclude "*" --include "*.html" --include "*.xml" --cache-control "max-age=10,stale-while-revalidate=60"
env:
targetBucket: s3://${{ fromJson(env.bucket)[matrix.environment] }}
1 change: 0 additions & 1 deletion .prettierignore

This file was deleted.

0 comments on commit a18fd4d

Please sign in to comment.