-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
133 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
permissions: | ||
contents: write | ||
packages: write | ||
pull-requests: write | ||
|
||
env: | ||
NODE_VERSION: 20 | ||
APP_NAME: reddit-chat-mobile-fix | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Set up Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ env.NODE_VERSION }} | ||
cache: 'npm' | ||
- name: Install Dependencies | ||
run: npm install | ||
- name: Build ${{ env.APP_NAME }} for Firefox | ||
run: npm run build:firefox | ||
|
||
- name: Create .zip for Firefox build | ||
uses: thedoctor0/[email protected] | ||
with: | ||
type: 'zip' | ||
filename: 'firefox.zip' | ||
path: 'dist/' | ||
- name: Build ${{ env.APP_NAME }} for Chrome | ||
run: npm run build:chrome | ||
|
||
- name: Create .zip for Chrome build | ||
uses: thedoctor0/[email protected] | ||
with: | ||
type: 'zip' | ||
filename: 'chrome.zip' | ||
path: 'dist/' | ||
|
||
changelog: | ||
name: Changelog | ||
needs: | ||
- lint | ||
- build | ||
- test | ||
if: github.event_name != 'pull_request' | ||
runs-on: ubuntu-latest | ||
|
||
outputs: | ||
skipped: ${{ steps.changelog.outputs.skipped }} | ||
tag: ${{ steps.changelog.outputs.tag }} | ||
clean_changelog: ${{ steps.changelog.outputs.clean_changelog }} | ||
version: ${{ steps.changelog.outputs.version }} | ||
|
||
env: | ||
PR_BRANCH: release-ci-${{ github.sha }} | ||
|
||
steps: | ||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | ||
- name: Create Branch | ||
run: | | ||
git checkout -b ${{ env.PR_BRANCH }} | ||
- name: Create Changelog | ||
uses: TriPSs/conventional-changelog-action@dd734f74fce61a6e02f821ee1b5930bc79a23534 # v5 | ||
id: changelog | ||
with: | ||
github-token: ${{ github.token }} | ||
git-user-name: "github-actions[bot]" | ||
git-user-email: "github-actions[bot]@users.noreply.github.com" | ||
git-branch: ${{ env.PR_BRANCH }} | ||
skip-git-pull: true | ||
output-file: false | ||
version-file: .github/package.yaml | ||
create-summary: true | ||
|
||
- name: Create Changelog PR | ||
if: steps.changelog.outputs.skipped == 'false' | ||
run: | | ||
gh pr create --base main --head ${{ env.PR_BRANCH }} --title 'chore(release): ${{ steps.changelog.outputs.tag }} [skip-ci]' --body '${{ steps.changelog.outputs.clean_changelog }}' | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
|
||
- name: Approve Changelog PR | ||
if: steps.changelog.outputs.skipped == 'false' | ||
run: | | ||
gh pr review --approve ${{ env.PR_BRANCH }} | ||
env: | ||
GH_TOKEN: ${{ secrets.GH_OWNER_TOKEN }} | ||
|
||
- name: Merge Changelog PR | ||
if: steps.changelog.outputs.skipped == 'false' | ||
run: | | ||
gh pr merge --squash --auto --delete-branch ${{ env.PR_BRANCH }} | ||
env: | ||
GH_TOKEN: ${{ secrets.GH_OWNER_TOKEN }} | ||
|
||
realease: | ||
name: realease | ||
needs: changelog | ||
if: github.event_name != 'pull_request' && needs.changelog.outputs.skipped == 'false' | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Upload Release | ||
uses: ncipollo/[email protected] | ||
with: | ||
artifacts: "firefox.zip,chrome.zip" | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
generateReleaseNotes: true | ||
draft: false | ||
prerelease: false | ||
tag: ${{ needs.changelog.outputs.tag }} | ||
name: ${{ needs.changelog.outputs.tag }} | ||
body: | | ||
<details> | ||
<summary>🤖 Autogenerated Conventional Changelog</summary> | ||
${{ needs.changelog.outputs.clean_changelog }} | ||
</details> | ||