-
-
Notifications
You must be signed in to change notification settings - Fork 21
148 lines (128 loc) · 4.59 KB
/
ci-push-main.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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
name: CI - Push to Main
on:
workflow_dispatch:
inputs:
importAll:
default: false
required: false
type: boolean
description: Enable, if you want to import all TODOs. Runs on checked out branch! Only use if you're sure what you are doing. (requires run_todo_bot to be true)
push:
branches:
- main
concurrency: ${{ github.workflow }}-${{ github.ref }}
permissions:
issues: write
repository-projects: read
contents: write
pull-requests: write
pages: write
id-token: write
jobs:
format:
name: Format Code
runs-on: ubuntu-latest
env:
NODE_OPTIONS: "--max_old_space_size=4096"
steps:
- name: Checkout Repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.STUDIOCMS_SERVICE_TOKEN }}
- name: Install Tools & Dependencies
uses: withstudiocms/automations/.github/actions/install
- name: Format code
run: pnpm run lint:fix
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@8621497c8c39c72f3e2a999a26b4ca1b5058a842 # v5
with:
commit_message: '[ci] lint'
branch: ${{ github.head_ref }}
commit_user_name: studiocms-no-reply
commit_user_email: [email protected]
commit_author: StudioCMS <[email protected]>
todo-auto-issue:
name: Create issues from TODOs
if: ${{ github.event_name == 'push' }}
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Run Todo Issue Bot
uses: juulsn/todo-issue@main
with:
excludePattern: '^(node_modules/)'
autoAssign: false
env:
GITHUB_TOKEN: ${{ secrets.STUDIOCMS_SERVICE_TOKEN }}
mergebot:
name: Merge Bot
if: ${{ github.repository_owner == 'withstudiocms' && github.event_name != 'workflow_dispatch' && github.event.commits[0].message != '[ci] lint' }}
uses: withstudiocms/automations/.github/workflows/mergebot.yml@main
secrets:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_MERGEBOT }}
changeset-release:
name: Changeset Release
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Install Tools & Dependencies
uses: withstudiocms/automations/.github/actions/install
- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
setupGitUser: true
commit: "👷 [ci]: Version Packages"
title: "👷 [ci]: Ready for Release"
version: pnpm ci:version
publish: pnpm ci:publish
env:
GITHUB_TOKEN: ${{ secrets.STUDIOCMS_SERVICE_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Add Label to CI PR
if: ${{ steps.changesets.outputs.hasChangesets == 'true' }}
run: gh pr edit "$PR_URL" --add-label "ci"
env:
PR_URL: ${{ steps.changesets.outputs.pull_request_url }}
GITHUB_TOKEN: ${{ secrets.STUDIOCMS_SERVICE_TOKEN }}
- name: Create Sentry release
if: steps.changesets.outputs.published == 'true'
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: withstudiocms
SENTRY_URL: https://sentry.studiocms.dev/
with:
environment: production
projects: node-playground ui-testing
# TODO: Migrate Lunaria workflows here once PR#333 is ready to be merged
# lunaria-build:
# name: Build Lunaria Overview
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
# with:
# fetch-depth: 0
# token: ${{ secrets.STUDIOCMS_SERVICE_TOKEN }}
# - name: Install Tools & Dependencies
# uses: withstudiocms/automations/.github/actions/install
# - name: Build Lunaria Overview
# run: pnpm ci:lunaria:build
# - name: Upload Overview
# uses: actions/upload-pages-artifact@v3
# with:
# path: "docs/dist/lunaria/"
# lunaria-deploy:
# name: Deploy Lunaria Overview
# runs-on: ubuntu-latest
# needs: lunaria-build
# environment:
# name: github-pages
# url: ${{ steps.lunaria-build.outputs.page_url }}
# steps:
# - name: Deploy to GitHub Pages
# uses: actions/deploy-pages@v4