mirror of
https://github.com/JamesIves/github-pages-deploy-action.git
synced 2023-12-15 20:03:39 +08:00
4e40ddd3f5
* Add a build step to create lib and node_modules artifact * Run integration test with built dist and current SHA as base For pull requests, the github.sha is the sha of the merge to the target branch, not the head of the PR. Special case that. * Use v2 checkout, and DRY_RUN for the integration test. I also made the branches more generic, as there are now more of them. * Fix #536, don't push at all on dryRun Also add tests for dryRun and singleCommit and generateBranch code flows. * Try to fix dryRun on new remote branches, refactor fetch * Try to fix dryRun, only fetch if origin branch exists * Refactor worktree setup to include branch generation and setup for singleCommit This is a continuation of the no-checkout work, and sadly suggested pretty intensive changes. * Set up git config to fix tests, also make debugging easier * Add matrix for existing and non-existing branch * Add matrix for singleCommit and not * Drop GITHUB_TOKEN, add DRY_RUN to action.yml * When deploying existing branch, add a modifcation and deploy again * Force branch checkout to work in redeployment scenarios * Make singleCommit easier to see in job descriptions * Review comments * Add a test-only property to action to test code paths with remote branch. * Introduce TestFlag enum to signal different test scenarios to unit tests * Fix util.test.ts
114 lines
2.6 KiB
YAML
114 lines
2.6 KiB
YAML
name: unit-tests
|
|
on:
|
|
pull_request:
|
|
branches:
|
|
- 'dev*'
|
|
- 'releases/v*'
|
|
push:
|
|
branches:
|
|
- dev
|
|
tags-ignore:
|
|
- '*.*'
|
|
jobs:
|
|
unit-tests:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
|
|
- uses: actions/setup-node@v1.4.4
|
|
with:
|
|
node-version: 'v12.18.4'
|
|
registry-url: 'https://registry.npmjs.org'
|
|
|
|
- name: Install Yarn
|
|
run: npm install -g yarn
|
|
|
|
- name: Install and Test
|
|
run: |
|
|
yarn install
|
|
yarn lint
|
|
yarn test
|
|
|
|
- name: Uploade CodeCov Report
|
|
uses: codecov/codecov-action@v1
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
|
|
- uses: actions/setup-node@v1.4.4
|
|
with:
|
|
node-version: 'v12.18.4'
|
|
registry-url: 'https://registry.npmjs.org'
|
|
|
|
- name: Install Yarn
|
|
run: npm install -g yarn
|
|
|
|
- name: Build lib
|
|
run: |
|
|
yarn install
|
|
yarn build
|
|
|
|
- name: Rebuild production node_modules
|
|
run: |
|
|
yarn install --production
|
|
ls node_modules
|
|
|
|
- name: artifact
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: dist
|
|
path: |
|
|
lib
|
|
node_modules
|
|
|
|
integration:
|
|
runs-on: ubuntu-latest
|
|
needs: build
|
|
strategy:
|
|
matrix:
|
|
branch: ["gh-pages", "no-pages"]
|
|
commit: ["singleCommit", "add commits"]
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- uses: actions/setup-node@v1.4.4
|
|
with:
|
|
node-version: 'v12.18.4'
|
|
registry-url: 'https://registry.npmjs.org'
|
|
|
|
- name: Download artifact
|
|
uses: actions/download-artifact@v2
|
|
with:
|
|
name: dist
|
|
|
|
- name: Deploy
|
|
uses: ./
|
|
with:
|
|
FOLDER: integration
|
|
BRANCH: ${{ matrix.branch }}
|
|
SINGLE_COMMIT: ${{ matrix.commit == 'singleCommit' }}
|
|
DRY_RUN: true
|
|
|
|
- name: Tweak content to publish to existing branch
|
|
if: ${{ matrix.branch == 'gh-pages' }}
|
|
run: |
|
|
echo "<!-- just sayin -->" >> integration/index.html
|
|
|
|
- name: Deploy with modifications to existing branch
|
|
uses: ./
|
|
if: ${{ matrix.branch == 'gh-pages' }}
|
|
with:
|
|
FOLDER: integration
|
|
BRANCH: ${{ matrix.branch }}
|
|
SINGLE_COMMIT: ${{ matrix.commit == 'singleCommit' }}
|
|
DRY_RUN: true
|