Workflow file for this run
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
name: Test | ||
on: | ||
push: | ||
branches: [ master, V4_Final ] | ||
pull_request: | ||
branches: [ master, V4_Final ] | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
packages: write | ||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: [16.20.0] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Install and run lint | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: 'npm' | ||
- run: npm ci | ||
- run: npm run lint | ||
tests: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: [16.20.0] | ||
test-script: ["ci:test-unit", "ci:test-e2e-layouts","ci:test-e2e-styleParams", "ci:test-e2e-integration"] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Install, build and run test | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: 'npm' | ||
- run: npm ci | ||
- run: npm run build | ||
- run: npm run ${{ matrix.test-script }} | ||
env: | ||
SURGE_LOGIN: ${{ secrets.SURGE_LOGIN }} | ||
SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }} | ||
TEST_NAME: ${{ matrix.test-script }} | ||
deploy: | ||
runs-on: ubuntu-latest | ||
needs: [lint, tests] | ||
strategy: | ||
matrix: | ||
node-version: [16.20.0] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
token: ${{ secrets.PAT_TOKEN }} | ||
fetch-depth: 0 | ||
- name: Install, build, configure git and lerna publish | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: 'npm' | ||
registry-url: 'https://registry.npmjs.org' | ||
- run: npm ci | ||
- run: npm run build --if-present | ||
- name: Configure Git | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "GitHub Actions - Pro Gallery" | ||
# Using a different format for the remote URL | ||
git remote set-url origin "https://x-access-token:${{ secrets.PAT_TOKEN }}@github.com/wix/pro-gallery.git" | ||
- run: | | ||
echo "registry=http://registry.npmjs.org/" >> .npmrc | ||
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> .npmrc | ||
env: | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
- name: Push to master | ||
if: github.event_name == 'push' | ||
run: | | ||
git checkout ${{ github.ref_name }} | ||
# Add these diagnostic commands | ||
echo "Current branch: $(git branch --show-current)" | ||
echo "Git status: $(git status)" | ||
# Configure npm and lerna to use the PAT token for GitHub operations | ||
npm config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }} | ||
npm config set @wix:registry=https://registry.npmjs.org/ | ||
# Run lerna with explicit authentication | ||
npx lerna publish patch --exact --yes --dist-tag stable --registry https://registry.npmjs.org/ --allow-branch ${{ github.ref_name }} --force-publish | ||
npm run changelog | ||
env: | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
GH_TOKEN: ${{ secrets.PAT_TOKEN }} | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
- name: Push to pull request | ||
if: github.event_name == 'pull_request' && github.actor != 'dependabot' | ||
run: | | ||
npx lerna publish --canary --preid ${{ github.sha }} --yes --registry https://registry.npmjs.org/ --allow-branch ${{ github.ref_name }} --force-publish | ||
env: | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
GH_TOKEN: ${{ secrets.PAT_TOKEN }} | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
update-playground: | ||
runs-on: ubuntu-latest | ||
if: github.ref == 'refs/heads/master' | ||
needs: [lint, tests] | ||
strategy: | ||
matrix: | ||
node-version: [16.20.0] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: update-playground | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: 'npm' | ||
registry-url: 'https://registry.npmjs.org' | ||
- run: npm ci | ||
- run: npm run build --if-present | ||
- run: node scripts/deployToSurge | ||
env: | ||
SURGE_LOGIN: ${{ secrets.SURGE_LOGIN }} | ||
SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }} |