Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to GHA from publisher #1044

Draft
wants to merge 3 commits into
base: publisher-staging
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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:
test:
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.

1 change: 0 additions & 1 deletion .publisher.yml

This file was deleted.

Loading