diff --git a/.artifacts.yml b/.artifacts.yml deleted file mode 100644 index 720dbb09..00000000 --- a/.artifacts.yml +++ /dev/null @@ -1,9 +0,0 @@ -version: v1 -publisher: - builds: - - filter: on-branch - name: publisher-branches - config: - node_version: 18.x - site_build_dir: _site - npm_build_script: build diff --git a/.github/workflows/basic.yml b/.github/workflows/basic.yml new file mode 100644 index 00000000..3ed8383f --- /dev/null +++ b/.github/workflows/basic.yml @@ -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 diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 00000000..cfc5399f --- /dev/null +++ b/.github/workflows/deploy.yml @@ -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] }} diff --git a/.prettierignore b/.prettierignore deleted file mode 120000 index f62e2b43..00000000 --- a/.prettierignore +++ /dev/null @@ -1 +0,0 @@ -.eslintignore \ No newline at end of file diff --git a/.publisher.yml b/.publisher.yml deleted file mode 100644 index f2b5b4af..00000000 --- a/.publisher.yml +++ /dev/null @@ -1 +0,0 @@ -subdomain: labs