-
Notifications
You must be signed in to change notification settings - Fork 9
101 lines (87 loc) · 3.89 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
name: 'CI'
on:
push:
branches:
- main
pull_request:
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [20]
permissions:
pull-requests: write
contents: write
steps:
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # ratchet:actions/checkout@v3
- uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # ratchet:actions/setup-node@v3
with:
node-version: 20
# build and test action
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Check format and lint
run: yarn run format-check && yarn lint
- name: Build and package
run: yarn build && yarn run package
- name: Update docs
uses: './'
with:
tocLevel: 1
- name: Update dist in the repository
if: github.ref != 'refs/heads/main'
uses: stefanzweifel/git-auto-commit-action@8756aa072ef5b4a080af5dc8fef36c5d586e521d # ratchet:stefanzweifel/[email protected]
with:
commit_message: 'chore(ci): Updating dist and docs'
file_pattern: 'dist/* README.md'
- name: Create Pull Request (main branch only)
if: github.ref == 'refs/heads/main'
uses: peter-evans/create-pull-request@70a41aba780001da0a30141984ae2a0c95d8704e # ratchet:peter-evans/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: 'chore(ci): Updating dist and docs'
title: 'chore(ci): Updating dist and docs'
branch: update-docs
branch-suffix: random
base: ${{ github.event.pull_request.base.ref }}
delete-branch: true
release:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: build
runs-on: ubuntu-latest
steps:
- name: Get app installation token
uses: npalm/action-app-token@dd4bb16d91ced5659bc618705c96b822c5a42136 # v1.1.0
id: app-token
with:
appId: ${{ vars.APP_ID }}
appPrivateKeyBase64: ${{ secrets.APP_PRIVATE_KEY_BASE64 }}
appInstallationType: repo
appInstallationValue: ${{ github.repository }}
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # ratchet:actions/checkout@v3
with:
fetch-depth: 0
- name: Release
uses: google-github-actions/release-please-action@a37ac6e4f6449ce8b3f7607e4d97d0146028dc0b # ratchet:google-github-actions/release-please-action@v3
id: release
with:
token: ${{ steps.app-token.outputs.token }}
release-type: simple
next-version: v2.0.0
last-release-sha: b62a69e27ae389aa92b450f647d37409b9277bf0
- name: tag major and minor versions
if: ${{ steps.release.outputs.release_created }}
run: |
git config user.name semantic-releaser[bot]
git config user.email 102556+semantic-releaser[bot]@users.noreply.github.com
git remote add gh-token "https://${{ steps.app-token.outputs.token }}@github.com/npalm/action-docs-action.git"
git tag -d v${{ steps.release.outputs.major }} || true
git tag -d v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} || true
git push origin :v${{ steps.release.outputs.major }} || true
git push origin :v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} || true
git tag -a v${{ steps.release.outputs.major }} -m "Release v${{ steps.release.outputs.major }}"
git tag -a v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} -m "Release v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}"
git push origin v${{ steps.release.outputs.major }}
git push origin v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}