|
| 1 | +name: Test Action |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + paths-ignore: |
| 8 | + - '*.md' |
| 9 | + pull_request: |
| 10 | + types: |
| 11 | + - opened |
| 12 | + - synchronize |
| 13 | + paths-ignore: |
| 14 | + - '*.md' |
| 15 | + |
| 16 | +jobs: |
| 17 | + skipci: |
| 18 | + runs-on: ubuntu-18.04 |
| 19 | + steps: |
| 20 | + - run: echo "[Skip CI] ${{ contains(github.event.head_commit.message, '[skip ci]') }}" |
| 21 | + |
| 22 | + test: |
| 23 | + runs-on: ${{ matrix.os }} |
| 24 | + if: contains(github.event.head_commit.message, '[skip ci]') == false |
| 25 | + strategy: |
| 26 | + matrix: |
| 27 | + os: |
| 28 | + - 'ubuntu-18.04' |
| 29 | + # - 'macos-latest' |
| 30 | + # - 'windows-latest' |
| 31 | + steps: |
| 32 | + |
| 33 | + - uses: actions/checkout@v2 |
| 34 | + |
| 35 | + - name: Read .nvmrc |
| 36 | + run: echo "::set-output name=NVMRC::$(cat .nvmrc)" |
| 37 | + id: nvm |
| 38 | + |
| 39 | + - name: Setup Node |
| 40 | + uses: actions/setup-node@v1 |
| 41 | + with: |
| 42 | + node-version: '${{ steps.nvm.outputs.NVMRC }}' |
| 43 | + |
| 44 | + - run: npm ci |
| 45 | + - run: npm run build |
| 46 | + |
| 47 | + - name: Setup mdBook |
| 48 | + uses: peaceiris/actions-mdbook@v1 |
| 49 | + with: |
| 50 | + mdbook-version: '0.3.5' |
| 51 | + |
| 52 | + - name: Build |
| 53 | + working-directory: ./test_projects/mdbook |
| 54 | + run: mdbook build |
| 55 | + |
| 56 | + - name: Prepare tag |
| 57 | + id: prepare_tag |
| 58 | + if: startsWith(github.ref, 'refs/tags/') |
| 59 | + run: | |
| 60 | + TAG_NAME="${GITHUB_REF##refs/tags/}" |
| 61 | + echo "::set-output name=tag_name::${TAG_NAME}" |
| 62 | + echo "::set-output name=deploy_tag_name::deploy-${TAG_NAME}" |
| 63 | +
|
| 64 | + - name: Deploy |
| 65 | + uses: ./ |
| 66 | + with: |
| 67 | + deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }} |
| 68 | + # github_token: ${{ secrets.GITHUB_TOKEN }} |
| 69 | + # publish_branch: master |
| 70 | + publish_dir: ./test_projects/mdbook/book |
| 71 | + # external_repository: '' |
| 72 | + allow_empty_commit: true |
| 73 | + # keep_files: true |
| 74 | + force_orphan: true |
| 75 | + # user_name: iris |
| 76 | + |
| 77 | + # commit_message: ${{ github.event.head_commit.message }} |
| 78 | + # tag_name: ${{ steps.prepare_tag.outputs.deploy_tag_name }} |
| 79 | + # tag_message: 'Deployment ${{ steps.prepare_tag.outputs.tag_name }}' |
| 80 | + |
| 81 | + # - name: Deploy v2 |
| 82 | + # uses: peaceiris/actions-gh-pages@v2 |
| 83 | + # env: |
| 84 | + # ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }} |
| 85 | + # PUBLISH_BRANCH: gh-pages |
| 86 | + # PUBLISH_DIR: ./test_projects/mdbook/book |
0 commit comments